/* Listener page: a poster that goes live (harness/07-ui-ux-studio-und-hoererseite.md,
   "Hörer-Seite"; harness/13-designsprache.md, "Hörer-Seite live"; ADR 0011).
   Mobile-first, one column of at most 32rem; two columns from 64rem.
   Live or not is keyed off [data-live] on #listener, which player.js keeps
   current. Colours only from tokens.css and /station.css. */

body {
  border-top: 8px solid var(--accent);
}

.listener {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 8px);
}

/* full-bleed areas, content in one column of at most 32rem */
.stage,
.console,
.extras {
  padding-inline: max(20px, calc((100% - 32rem) / 2));
}

/* ---- the stage: station colour while live, a quiet surface otherwise ---- */

.stage {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  padding-block: var(--space-4) var(--space-5);
  background: var(--paper-2);
  color: var(--ink);
}

[data-live="true"] .stage,
[data-live="true"] .console {
  background: var(--accent);
  color: var(--on-accent);
}

[data-live="true"] .stage :focus-visible,
[data-live="true"] .console :focus-visible {
  outline-color: var(--on-accent);
}

.stage-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  min-height: 32px;
}

.stage-top > .label {
  margin-left: auto;
}

[data-live="false"] .stage-top > .label {
  color: var(--ink-2);
}

/* the live marker, inverted on the station colour */
.stage .live {
  padding: 6px 10px;
  background: var(--on-accent);
  color: var(--accent);
}

.station {
  margin-top: var(--space-6);
  font-size: clamp(2.75rem, 17vw, 4.5rem);
  font-weight: 800;
  line-height: 0.92;
  letter-spacing: -0.04em;
  overflow-wrap: anywhere;
  hyphens: auto;
}

.description {
  max-width: 34ch;
  white-space: pre-line;
}

[data-live="false"] .description {
  color: var(--ink-2);
}

.rule {
  height: 0;
  margin: var(--space-2) 0 0;
  border: 0;
  border-top: 3px solid currentColor;
  color: inherit;
}

.show .label {
  display: block;
}

.show-title {
  display: block;
  margin-top: var(--space-1);
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}

.off-air {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.off-air-title {
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.waiting {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 44px;
  color: var(--ink-2);
}

.wait-bars {
  display: inline-flex;
  align-items: flex-end;
  gap: 3px;
  height: 16px;
}

.wait-bars span {
  width: 4px;
  height: 100%;
  background: currentColor;
  transform: scaleY(0.4);
  transform-origin: bottom;
  animation: wait 2.4s ease-in-out infinite;
}

.wait-bars span:nth-child(2) {
  animation-delay: -0.8s;
}

.wait-bars span:nth-child(3) {
  animation-delay: -1.6s;
}

@keyframes wait {
  0%,
  100% {
    transform: scaleY(0.3);
  }
  50% {
    transform: scaleY(1);
  }
}

/* ---- the play block: one black block, word and state ------------------- */

.console {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding-block: 0 var(--space-6);
}

[data-live="false"] .console {
  display: none;
}

.play {
  display: grid;
  grid-template-columns: 80px minmax(0, 1fr) auto;
  align-items: stretch;
  justify-content: stretch;
  width: 100%;
  min-height: 80px;
  padding: 0;
  border: 1px solid #111111;
  background: #111111;
  color: #ffffff;
  text-align: left;
}

.play:hover {
  background: #000000;
}

.play-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  border-right: 1px solid #3a3a3a;
}

.play-icon svg {
  width: 28px;
  height: 28px;
  fill: currentColor;
}

.play .icon-pause,
.play[data-playing="true"] .icon-play {
  display: none;
}

.play[data-playing="true"] .icon-pause {
  display: block;
}

.play-text {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  padding: var(--space-3) var(--space-3) var(--space-3) var(--space-4);
}

.play-title {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.2;
}

.play-sub {
  color: #bdbdbd;
  font-size: 0.875rem;
  font-weight: 400;
}

/* the activity bars, in the station colour, moving only while playing */
.play .bars {
  align-self: center;
  width: 44px;
  height: 28px;
  margin-right: var(--space-4);
  gap: 3px;
  border-bottom: 0;
}

.play .bars span {
  background: var(--accent);
  transform: scaleY(0.18);
}

.volume {
  display: none;
}

/* with JavaScript the block replaces the native player */
.js .native-player {
  display: none;
}

.native-player {
  width: 100%;
}

/* ---- below the stage: pass it on ---------------------------------------- */

.extras {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  padding-block: var(--space-6) var(--space-7);
}

.share {
  width: 100%;
  min-height: 52px;
  gap: var(--space-3);
}

.share svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: square;
}

.hint {
  margin-top: var(--space-2);
  color: var(--ink-2);
  font-size: 0.875rem;
}

[data-live="true"] .when-offline,
[data-live="false"] .when-live {
  display: none;
}

.page-url {
  margin-top: var(--space-2);
  font-size: 0.875rem;
}

.apps {
  border-top: var(--line);
  border-bottom: var(--hairline);
}

.apps summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  min-height: 52px;
  font-weight: 600;
  list-style: none;
  cursor: pointer;
}

.apps summary::-webkit-details-marker {
  display: none;
}

.apps summary::after {
  content: "+";
  font-size: 1.5rem;
  font-weight: 400;
  line-height: 1;
}

.apps[open] summary::after {
  content: "–";
}

.apps-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding-bottom: var(--space-4);
}

.link-row {
  display: flex;
  gap: var(--space-2);
}

.link-row input {
  flex: 1;
  min-width: 0;
  font-size: 0.875rem;
}

.copy {
  flex: none;
}

.tip {
  color: var(--ink-2);
  font-size: 0.875rem;
}

/* ---- desktop: the stage left, player and the rest right ----------------- */

@media (min-width: 64rem) {
  .listener {
    display: grid;
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
    grid-template-rows: auto 1fr;
  }

  .stage {
    grid-column: 1;
    grid-row: 1 / -1;
    padding: var(--space-7) var(--space-8);
  }

  .station {
    margin-top: var(--space-8);
    font-size: clamp(4.5rem, 7.5vw, 9rem);
  }

  .show-title,
  .off-air-title {
    font-size: 2.5rem;
  }

  .rule {
    margin-top: auto;
  }

  .console,
  .extras {
    grid-column: 2;
    padding-inline: var(--space-7);
  }

  .console {
    grid-row: 1;
    padding-block: var(--space-8) 0;
  }

  [data-live="true"] .console {
    background: transparent;
    color: var(--ink);
  }

  [data-live="true"] .console :focus-visible {
    outline-color: var(--ink);
  }

  .extras {
    grid-row: 2;
    align-content: start;
    justify-content: start;
    padding-block: var(--space-6) var(--space-7);
  }

  [data-live="false"] .extras {
    padding-top: var(--space-8);
  }

  .volume {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    min-height: 44px;
  }

  .volume input {
    flex: 1;
    margin: 0;
    accent-color: var(--ink);
  }
}

/* on the dark page the black block needs an edge */
@media (min-width: 64rem) and (prefers-color-scheme: dark) {
  .play {
    border-color: #3a3a3a;
  }
}
