/* EclecticFM: Late-Night Lounge. A dark card lit from above: plum glow,
   amber lamplight, a soft italic serif. One mood under one light, so it
   does not follow the viewer's colour scheme. */

/* Self-hosted so the installed app renders offline and the page makes no
   third-party request. optional (not swap): a font that misses first
   paint is skipped rather than reflowed into, the CLS trade Hard Bop 24
   makes too. */
@font-face {
  font-family: "Fraunces";
  src: url("fonts/fraunces-italic-latin-var.woff2")
    format("woff2-variations");
  font-style: italic;
  font-weight: 400 600;
  font-display: optional;
}
@font-face {
  font-family: "DM Sans";
  src: url("fonts/dm-sans-latin-var.woff2") format("woff2-variations");
  font-weight: 400 700;
  font-display: optional;
}

:root {
  --board: #120b15; /* behind the card */
  --night: #1c1220; /* the card; theme-color */
  --plum: #4a1d2f; /* the glow at the top of the card */
  --amber: #e8a33d; /* 8.42:1 on night, 6.46:1 on plum; the icon's bird */
  --coral: #d9663b; /* 5.11:1 on night */
  --cream: #f3e6d3; /* 14.76:1 on night */
  --dusk: #a8968a; /* 6.39:1 on night, 4.90:1 on plum */
  --brass: #c9a46a; /* 7.78:1 on night, 5.97:1 on plum */
  --line: rgba(243, 230, 211, 0.12);
  --hairline: rgba(243, 230, 211, 0.06);

  /* House sleeve, shared by the cover and the history thumbnails: the
     station's bird. Shows before real art arrives and stays for tracks
     with no cover. Lives in CSS so it paints before player.js runs.
     Generated from assets/appicon/eclecticfm.svg. */
  --house-sleeve: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/200\
0/svg' viewBox='0 0 1200 1200'><rect width='1200' height='1200' fill='%231c1\
220'/><path d='m933.43 924.04-170.33-170.33c103.14-22.316 176.82-113.51 176.\
97-219.04v-184.05c-0.089843-62.582-50.773-113.3-113.36-113.36h-136.03c-12.51\
6 0-22.672 10.156-22.672 22.672 0 6.0234 2.3906 11.777 6.6406 16.031l39.734 \
39.734c8.8281 8.8555 8.8281 23.203 0 32.059l-357.14 357.11c-8.8555 8.8555-8.\
8555 23.203 0 32.059 17.359 17.445 39.941 28.723 64.324 32.117l-155.01 155.0\
1c-8.8555 8.8555-8.8555 23.203 0 32.059 4.25 4.25 10.008 6.6406 16.031 6.640\
6h247.79c9.1797 0 17.418-5.5195 20.93-13.992l63.676-153.5 63.469 153.27c4.81\
25 11.57 18.066 17.062 29.637 12.25 11.57-4.8125 17.062-18.066 12.25-29.637l\
-71.41-172.42h54.996l197.4 197.4c9.0039 8.707 23.352 8.4414 32.059-0.5625 8.\
5-8.7695 8.5-22.699 0.03125-31.5zm-318.41-210.69c-9.1797 0-17.445 5.5195-20.\
957 13.992l-78.789 190.05h-177.95l229.46-229.46c12.723-12.781 30.051-19.984 \
48.09-19.926h101.14c73.625-0.089844 133.29-59.75 133.37-133.35 0.5625-54.109\
-32.117-103-82.336-123.19-13.43-5.6094-27.66-9.0039-42.156-10.125l21.52-21.5\
51c26.508-26.566 26.508-69.609 0-96.18l-1.0039-1.0352h81.301c37.551 0.058593\
 67.957 30.465 68.016 68.016v184.05c-0.11719 98.629-80.059 178.57-178.69 178\
.69z' fill='%23e8a33d'/></svg>");

  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "DM Sans", "Helvetica Neue", Arial, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: var(--board);
  color: var(--cream);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

.player {
  width: min(26rem, 100%);
  padding: 1.4rem;
  border-radius: 20px;
  background:
    radial-gradient(120% 55% at 50% 0%, var(--plum) 0%, transparent 70%),
    var(--night);
  box-shadow:
    0 0 0 1px var(--hairline),
    0 30px 80px -20px #000;
}

.masthead {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
}

.badge,
.spec,
.status,
.section-heading {
  margin: 0;
  font-size: 0.62rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--brass);
}

.badge::before {
  content: "";
  display: inline-block;
  width: 0.5em;
  height: 0.5em;
  margin-right: 0.55em;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 8px var(--amber);
  vertical-align: 0.05em;
}

.badge.off {
  color: var(--dusk);
}
.badge.off::before {
  background: var(--dusk);
  box-shadow: none;
}

.name {
  margin: 0.55rem 0 1rem;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: 2.2rem;
  line-height: 1.1;
  font-variation-settings: "WONK" 1;
}

.name em {
  color: var(--amber);
}

.art {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 12px;
  /* A loaded cover is opaque and object-fit: cover, so it paints over the
     sleeve entirely. */
  background: var(--night) var(--house-sleeve) center / cover no-repeat;
  box-shadow:
    0 22px 50px -12px rgba(232, 163, 61, 0.33),
    0 0 0 1px var(--line);
}

.meta {
  margin-top: 1.15rem;
}

.title {
  margin: 0;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 500;
  font-size: 1.7rem;
  line-height: 1.05;
  text-wrap: balance;
}

.artist {
  margin: 0.4rem 0 0;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--amber);
}

.album {
  margin: 0.25rem 0 0;
  font-size: 0.8rem;
  color: var(--dusk);
}

.toggle {
  display: block;
  margin-top: 1.4rem;
  width: 100%;
  padding: 0.8rem 1rem;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--amber), var(--coral));
  color: var(--night);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.28em;
  text-indent: 0.28em; /* offsets the trailing letter-space */
  cursor: pointer;
}

.toggle:hover {
  filter: brightness(1.08);
}

.toggle:focus-visible,
.stream-copy:focus-visible,
.stream-url:focus-visible {
  outline: 3px solid var(--amber);
  outline-offset: 3px;
}

.status {
  margin-top: 0.7rem;
  text-align: center;
  color: var(--coral);
}

.hidden {
  display: none;
}

/* Motion: a new record dropping. The cover brightens in and the titles
   settle. The fade starts above zero opacity so the cover still counts
   as painted for LCP. */
@keyframes settle {
  from {
    opacity: 0;
    transform: translateY(0.4rem);
  }
}
@keyframes glow-in {
  from {
    opacity: 0.35;
  }
}

.meta.enter {
  animation: settle 0.45s ease-out both;
}
.art.enter {
  animation: glow-in 0.6s ease-out both;
}

@media (prefers-reduced-motion: reduce) {
  .meta.enter,
  .art.enter {
    animation: none;
  }
}

.history,
.streams {
  margin-top: 1.6rem;
}

.section-heading {
  margin-bottom: 0.3rem;
  padding-bottom: 0.45rem;
  border-bottom: 1px solid var(--line);
}

.history-list,
.stream-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Rows have a fixed height and single-line text so the list's settled
   height is known before the first poll fills it: reserve it up front
   rather than shifting everything below (the API returns 5 entries). */
.history-list {
  min-height: calc(5 * 5rem);
}

.history-row {
  display: grid;
  grid-template-columns: 3.5rem minmax(0, 1fr);
  column-gap: 0.75rem;
  align-content: center;
  height: 5rem;
  padding: 0.45rem 0;
}

.history-row + .history-row,
.stream-row + .stream-row {
  border-top: 1px solid var(--hairline);
}

.history-art {
  grid-row: span 4;
  align-self: center;
  width: 3.5rem;
  height: 3.5rem;
  object-fit: cover;
  border-radius: 7px;
  background: var(--night) var(--house-sleeve) center / cover no-repeat;
}

.history-title,
.history-artist,
.history-album,
.history-time {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.history-title {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 500;
  font-size: 0.9rem;
  line-height: 1.25;
}

.history-artist,
.history-album {
  font-size: 0.74rem;
  line-height: 1.35;
  color: var(--dusk);
}

.history-album {
  font-style: italic;
}

.history-time {
  font-size: 0.66rem;
  line-height: 1.35;
  font-variant-numeric: tabular-nums;
  color: var(--dusk);
}

.stream-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 0.65rem;
  align-items: center;
  padding: 0.45rem 0;
}

.stream-format {
  grid-column: 1;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.stream-note {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--dusk);
}

.stream-url {
  grid-column: 1;
  font-size: 0.7rem;
  color: var(--dusk);
  overflow-wrap: anywhere;
}

.stream-url:hover {
  color: var(--amber);
}

.stream-copy {
  grid-column: 2;
  grid-row: 1 / span 2;
  padding: 0.35rem 0.75rem;
  border: 1px solid rgba(232, 163, 61, 0.55);
  border-radius: 999px;
  background: transparent;
  color: var(--amber);
  font: inherit;
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  cursor: pointer;
}

.stream-copy:hover {
  background: var(--amber);
  color: var(--night);
}
