/* The music page (music/index.html, drawn by /assets/js/music.js),
   loaded on that page only, after site.css.

   In the site's own pieces and nothing else: type, hairlines, rows.
   Two market maps (the top songs and the top artists, each rectangle
   as big as its plays, filled by its cover), a curve across the day,
   columns, a grid, bars cut into parts, a calendar of covers and a
   timeline. The only colour is the covers' own. */

.music [hidden] { display: none !important; }

.music__body {
  display: flex;
  flex-direction: column;
  gap: var(--s16);
}

.music__empty,
.log__empty {
  color: var(--gray);
}

/* figures line up, in the serif's even-width numerals */
.music {
  font-variant-numeric: lining-nums tabular-nums;
}

.block__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s2) var(--s4);
  margin-bottom: var(--s4);
}

.block__head .label {
  margin: 0;
}

.block__meta {
  font-size: var(--small);
  color: var(--faint);
}

.music .label {
  margin-bottom: var(--s4);
}

.sub {
  margin-bottom: var(--s3);
  color: var(--fg-2);
}

.habit__note {
  min-height: 1.5em;
  margin-top: var(--s2);
  font-size: var(--small);
  line-height: 1.5;
  color: var(--gray);
}

/* ---------- Off the air ---------- */
.off {
  margin-bottom: var(--s8);
  padding-left: var(--s4);
  border-left: 2px solid var(--fg);
}

.off__why,
.off__clock {
  color: var(--gray);
}

.off__count {
  color: var(--fg);
}

/* ---------- Now ----------
   The cover large, and beside it the song set large, its artist, and
   a hairline for how far through it is. */
.now {
  display: grid;
  grid-template-columns: 12rem minmax(0, 1fr);
  gap: var(--s8);
  align-items: end;
}

.now__art {
  display: block;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 3px;
  background: var(--hover);
}

.now__art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.now__when {
  display: flex;
  align-items: center;
  gap: var(--s2);
  color: var(--gray);
}

/* while a song plays, four bars moving beside "Playing now" */
.now__eq {
  display: none;
  align-items: flex-end;
  gap: 2px;
  height: 0.7rem;
}

.now.is-live .now__eq {
  display: inline-flex;
}

.now__eq i {
  width: 2px;
  height: 100%;
  background: var(--fg);
  transform-origin: bottom;
  animation: eq 1s ease-in-out infinite;
}

.now__eq i:nth-child(2) { animation-delay: -0.35s; animation-duration: 0.8s; }
.now__eq i:nth-child(3) { animation-delay: -0.6s; animation-duration: 1.15s; }
.now__eq i:nth-child(4) { animation-delay: -0.15s; animation-duration: 0.9s; }

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

.now__name {
  margin-top: var(--s2);
  font-size: var(--name);
  line-height: 1.05;
  letter-spacing: -0.015em;
  overflow-wrap: anywhere;
}

.now__by {
  margin-top: var(--s2);
  font-size: 1.25rem;
  color: var(--gray);
}

.now__progress {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--s3);
  margin-top: var(--s6);
}

.now__t {
  font-size: var(--small);
  color: var(--gray);
}

.now__bar {
  position: relative;
  height: 1px;
  background: var(--line);
}

.now__bar i {
  position: absolute;
  inset: -0.5px 0;
  background: var(--fg);
  transform: scaleX(0);
  transform-origin: left;
}

@media (max-width: 34rem) {
  .now {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--s4);
  }

  .now__art { max-width: 14rem; }
}

/* ---------- The range ----------
   One choice for everything under it, Past 7 days or Past 30, set like
   the theme switch, and held at the top of the window while you read. */
.range {
  display: flex;
  flex-direction: column;
  gap: var(--s12);
}

.range__bar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: baseline;
  gap: var(--s6);
  margin-bottom: calc(var(--s8) * -1);
  padding: var(--s3) 0;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.range__dates {
  margin-left: auto;
  font-size: var(--small);
  color: var(--faint);
}

.switch {
  display: inline-flex;
  gap: var(--s4);
}

.switch__option {
  color: var(--faint);
  transition: color var(--fast);
}

.switch__option:hover,
.switch__option[aria-pressed="true"] {
  color: var(--fg);
}

/* The figures, large, each with its change since the time before */
.figures {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.figure {
  min-width: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas: "v d" "t t";
  align-items: baseline;
  column-gap: var(--s2);
  padding-right: var(--s4);
}

.figure + .figure {
  padding-left: var(--s4);
  border-left: 1px solid var(--line);
}

.figure__v {
  grid-area: v;
  font-size: clamp(2rem, 3.6vw, 2.75rem);
  line-height: 1;
  letter-spacing: -0.015em;
  white-space: nowrap;
}

.figure__d {
  grid-area: d;
  justify-self: start;
  font-size: var(--small);
  color: var(--faint);
}

.figure__t {
  grid-area: t;
  margin-top: var(--s2);
  color: var(--gray);
}

.figures__note {
  margin-top: var(--s4);
  font-size: var(--small);
  color: var(--faint);
}

@media (max-width: 47.99rem) {
  .figures { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: var(--s6); }
  .figure:nth-child(3) { padding-left: 0; border-left: 0; }
}

/* ---------- Market maps ----------
   A grid of sixteen square cells (eight on a phone), the covers meeting
   edge to edge; each spans as many cells across as down (8, 4, 2 or 1),
   so it stays square, and music.js gives each size enough covers to
   fill whole rows. */
.block:has(> .tm) {
  container-type: inline-size;
}

.tm {
  --cols: 16;
  --gap: 0px;
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  grid-auto-rows: calc((100cqw - (var(--cols) - 1) * var(--gap)) / var(--cols));
  grid-auto-flow: dense;
  gap: var(--gap);
}

.tm__tile {
  position: relative;
  overflow: hidden;
  background: var(--hover);
  color: #fff;
  transition: opacity 0.2s ease, filter 0.2s ease;
}

.tm__tile.k1 { grid-column: span 1; grid-row: span 1; }
.tm__tile.k2 { grid-column: span 2; grid-row: span 2; }
.tm__tile.k4 { grid-column: span 4; grid-row: span 4; }
.tm__tile.k8 { grid-column: span 8; grid-row: span 8; }

.tm:hover .tm__tile:not(:hover) {
  opacity: 0.4;
  filter: grayscale(0.7);
}

.tm__art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* a square without a picture: the name in type, a hairline keeping
   neighbours apart now the covers meet edge to edge */
.tm__tile.is-type {
  display: flex;
  align-items: flex-end;
  padding: 0.5rem;
  background: var(--hover);
  box-shadow: inset 0 0 0 0.5px var(--line);
  color: var(--fg-2);
}

.tm__type {
  overflow: hidden;
  font-size: 0.875rem;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.tm__tile.is-type.k1 {
  align-items: center;
  justify-content: center;
  padding: 0;
}

.tm__tile.is-type.k1 .tm__type {
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  color: var(--gray);
}

.tm__tile.is-type.k4 .tm__type,
.tm__tile.is-type.k8 .tm__type {
  font-size: 1.5rem;
  line-height: 1.1;
}

/* the label beside whichever cover is pointed at */
.tm__tip {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  max-width: 18rem;
  padding: 0.35rem 0.6rem;
  border-radius: 6px;
  background: var(--fg);
  color: var(--bg);
  font-size: var(--small);
  line-height: 1.3;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease;
}

.tm__tip.is-on {
  opacity: 1;
}

.tm__tip-name,
.tm__tip-by {
  overflow: hidden;
  text-overflow: ellipsis;
}

.tm__tip-by {
  opacity: 0.7;
}

@media (max-width: 47.99rem) {
  .tm { --cols: 8; }
}

/* ---------- Rows of songs ---------- */
.tracks {
  margin-inline: calc(var(--pad) * -1);
}

.track {
  display: grid;
  grid-template-columns: 1.5rem 2.25rem minmax(0, 1fr) auto;
  column-gap: var(--s3);
  align-items: center;
  padding: 0.3rem var(--pad);
  border-radius: 6px;
  transition: background var(--fast);
}

.track--bare {
  grid-template-columns: 2.25rem minmax(0, 1fr) auto;
}

a.track:hover {
  background: var(--hover);
}

.track__n,
.track__count {
  font-size: var(--small);
  color: var(--faint);
}

.track__count {
  text-align: right;
  white-space: nowrap;
}

.track__art {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 2px;
  object-fit: cover;
  background: var(--hover);
}

.track__text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.35;
}

.track__name,
.track__by {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.track__by {
  font-size: var(--small);
  color: var(--gray);
}

/* ---------- Standouts: rows ----------
   What each stands out for, the thing itself, and its figure. Two
   columns of five. */
.stands {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  margin-inline: calc(var(--pad) * -1);
}

.stand {
  display: grid;
  grid-template-columns: 7.5rem 2.25rem minmax(0, 1fr) auto;
  column-gap: var(--s3);
  align-items: center;
  padding: 0.35rem var(--pad);
  border-radius: 6px;
  transition: background var(--fast);
}

a.stand:hover {
  background: var(--hover);
}

.stand__label {
  font-size: var(--small);
  color: var(--gray);
}

.stand__art {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 2px;
  object-fit: cover;
  background: var(--hover);
}

.stand--artist .stand__art {
  border-radius: 50%;
}

.stand__text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.35;
}

.stand__name,
.stand__by {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.stand__by {
  font-size: var(--small);
  color: var(--gray);
}

.stand__value {
  font-size: var(--small);
  text-align: right;
  white-space: nowrap;
}

@media (max-width: 55.99rem) {
}

/* ---------- When ---------- */
.habits {
  display: flex;
  flex-direction: column;
  gap: var(--s12);
}

.habits .block > * + * {
  margin-top: var(--s8);
}

.when {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--s8) var(--s12);
}

@media (max-width: 47.99rem) {
  .when { grid-template-columns: minmax(0, 1fr); }
}

/* Columns: a bar for each hour or day, as tall as its share of the
   busiest, the busiest in ink */
.cols__plot {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 7rem;
  border-bottom: 1px solid var(--line);
}

.cols--perday .cols__plot {
  gap: 2px;
}

.cols__col {
  flex: 1;
  min-width: 0;
  height: max(1px, calc(var(--v, 0) * 100%));
  background: var(--line);
  transition: background var(--fast);
}

.cols__col.is-lit {
  background: var(--fg);
}

.cols__col:hover {
  background: var(--gray);
}

.cols__axis {
  display: flex;
  gap: 3px;
  margin-top: var(--s1);
}

.cols--perday .cols__axis {
  gap: 2px;
}

.cols__tick {
  flex: 1;
  min-width: 0;
  overflow: visible;
  white-space: nowrap;
  font-size: 0.75rem;
  color: var(--faint);
}

.cols--days .cols__tick {
  text-align: center;
}

/* Hour by day: a cell per hour, darker for more plays */
.heat__grid,
.heat__axis {
  display: grid;
  grid-template-columns: 3.25rem repeat(24, minmax(0, 1fr));
  gap: 2px;
}

.heat__day {
  align-self: center;
  font-size: 0.75rem;
  line-height: 1;
  color: var(--faint);
}

.heat__cell {
  aspect-ratio: 1.2;
  border-radius: 1px;
  background: color-mix(in srgb, var(--fg) calc(var(--v, 0) * 100%), var(--hover));
  outline: 1px solid transparent;
  outline-offset: 1px;
  transition: outline-color var(--fast);
}

.heat__cell.is-none {
  background: var(--hover);
}

.heat__cell:hover {
  outline-color: var(--fg);
}

.heat__axis {
  margin-top: var(--s1);
}

/* ---------- What: each breakdown, one bar cut into its parts ---------- */
.comps {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s8) var(--s12);
}

@media (max-width: 47.99rem) {
  .comps { grid-template-columns: minmax(0, 1fr); }
}

.comp__bar {
  display: flex;
  height: 0.5rem;
  gap: 2px;
  margin-bottom: var(--s3);
}

.comp__seg {
  flex: var(--w) 0 0;
  min-width: 2px;
  background: color-mix(in srgb, var(--fg) calc(100% - var(--i, 0) * 13%), var(--bg));
  transition: opacity var(--fast);
}

.comp__seg--rest {
  background: var(--line);
}

.is-pointing .comp__seg:not(.is-on),
.is-pointing .comp__item:not(.is-on) {
  opacity: 0.35;
}

.comp__legend {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.comp__item {
  display: grid;
  grid-template-columns: 0.625rem minmax(0, 1fr) auto;
  align-items: center;
  column-gap: var(--s2);
  transition: opacity var(--fast);
}

.comp__sw {
  width: 0.5rem;
  height: 0.5rem;
  background: color-mix(in srgb, var(--fg) calc(100% - var(--i, 0) * 13%), var(--bg));
}

.comp__name {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.comp__v {
  font-size: var(--small);
  color: var(--gray);
}

/* where the parts overlap: a thin bar each */
.comp__legend--bars {
  gap: var(--s2);
}

.comp__legend--bars .comp__item {
  grid-template-columns: minmax(0, 1fr) auto;
  row-gap: 0.25rem;
}

.comp__legend--bars .comp__sw {
  display: none;
}

.comp__own {
  grid-column: 1 / -1;
  position: relative;
  height: 2px;
  background: var(--line);
}

.comp__own i {
  position: absolute;
  inset: 0 auto 0 0;
  width: calc(var(--w, 0) * 100%);
  background: var(--gray);
}

.comp__legend--bars .comp__item:first-child .comp__own i {
  background: var(--fg);
}

/* ---------- How: the figures, in three lists ---------- */
.facts3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--s8);
}

@media (max-width: 47.99rem) {
  .facts3 { grid-template-columns: minmax(0, 1fr); }
}

.facts {
  display: flex;
  flex-direction: column;
  gap: var(--s4);
}

.fact__v {
  font-size: 1.5rem;
  letter-spacing: -0.008em;
  line-height: 1.15;
}

.fact__t {
  color: var(--fg-2);
  line-height: 1.35;
}

.fact__more {
  font-size: var(--small);
  line-height: 1.4;
  color: var(--faint);
}

/* ---------- The calendar, and the day picked ---------- */
.cal__nav {
  display: flex;
  align-items: center;
  gap: var(--s1);
}

.cal__month {
  min-width: 8.5rem;
  text-align: center;
}

.cal__yr {
  color: var(--gray);
}

.cal__step {
  display: grid;
  place-items: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 6px;
  font-size: 1.125rem;
  line-height: 1;
  color: var(--gray);
  transition: background var(--fast), color var(--fast);
}

.cal__step:hover:not(:disabled) {
  background: var(--hover);
  color: var(--fg);
}

.cal__step:disabled {
  opacity: 0.3;
  cursor: default;
}

.cal {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: var(--s12);
  align-items: start;
}

@media (max-width: 47.99rem) {
  .cal { grid-template-columns: minmax(0, 1fr); gap: var(--s8); }
}

.cal__grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 3px;
}

.cal__wd {
  padding-bottom: var(--s1);
  font-size: 0.75rem;
  color: var(--faint);
  text-align: center;
}

.cal__cell {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 2px;
  background: var(--hover);
  transition: box-shadow var(--fast);
}

.cal__art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cal__n {
  position: absolute;
  top: 4px;
  left: 5px;
  font-size: 0.75rem;
  line-height: 1;
  color: var(--gray);
}

.cal__cell.has-art .cal__n {
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
}

.cal__cell.is-off {
  background: transparent;
  cursor: default;
}

.cal__cell.is-off .cal__n {
  color: var(--faint);
}

.cal__cell.is-today:not([aria-pressed="true"]) {
  box-shadow: inset 0 0 0 1px var(--faint);
}

.cal__cell[aria-pressed="true"] {
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 3px var(--fg);
}

.day__when {
  color: var(--gray);
}

.day__date {
  font-size: var(--name);
  line-height: 1.05;
  letter-spacing: -0.015em;
}

.day__stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--s2);
  margin: var(--s4) 0 var(--s3);
}

.day__v {
  font-size: 1.25rem;
  letter-spacing: -0.01em;
}

.day__t {
  font-size: var(--small);
  color: var(--gray);
}

.day__line {
  font-size: var(--small);
  line-height: 1.5;
  color: var(--gray);
}

.day .tracks {
  margin-top: var(--s4);
}

.day__toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: calc(100% + var(--pad) * 2);
  margin: var(--s2) calc(var(--pad) * -1) 0;
  padding: 0.35rem var(--pad);
  border-radius: 6px;
  color: var(--gray);
  transition: background var(--fast), color var(--fast);
}

.day__toggle:hover {
  background: var(--hover);
  color: var(--fg);
}

.day__sign::before {
  content: "+";
}

.day__toggle[aria-expanded="true"] .day__sign::before {
  content: "\2212";
}

.day__span {
  margin: var(--s3) 0 var(--s2);
  font-size: var(--small);
  color: var(--faint);
}

/* ---------- Today: a timeline ---------- */
.log {
  max-width: var(--measure);
}

.timeline {
  position: relative;
}

/* the line, through the dots */
.timeline::before {
  content: "";
  position: absolute;
  top: 0.9rem;
  bottom: 0.9rem;
  left: calc(4.5rem + 0.5rem - 0.5px);
  width: 1px;
  background: var(--line);
}

.stop {
  position: relative;
  display: grid;
  grid-template-columns: 4.5rem 1rem minmax(0, 1fr);
  align-items: center;
}

.stop__time {
  font-size: var(--small);
  color: var(--faint);
}

.stop__dot {
  z-index: 1;
  justify-self: center;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--bg);
  box-shadow: inset 0 0 0 1.5px var(--faint);
}

.stop--now .stop__time {
  color: var(--fg);
}

.stop--now .stop__dot {
  background: var(--fg);
  box-shadow: 0 0 0 3px var(--bg), 0 0 0 4px var(--fg);
}

.stop__song {
  display: flex;
  align-items: center;
  gap: var(--s3);
  min-width: 0;
  margin-left: var(--s2);
  padding: 0.3rem var(--pad);
  border-radius: 6px;
  transition: background var(--fast);
}

a.stop__song:hover {
  background: var(--hover);
}

.stop__art {
  flex: none;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 2px;
  object-fit: cover;
  background: var(--hover);
}

.stop__text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.35;
}

.stop__name,
.stop__by {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.stop__by {
  font-size: var(--small);
  color: var(--gray);
}

.log__more {
  margin: var(--s3) 0 0 6rem;
  color: var(--gray);
  transition: color var(--fast);
}

.log__more:hover {
  color: var(--fg);
}

@media (prefers-reduced-motion: reduce) {
  .now__eq i { animation: none; transform: scaleY(0.6); }
}

/* ---------- Quiet, like the rest of the site ----------
   One size of type here too: the song playing, and the figures, set
   in the line like everything else, with no rules between them. */
.now {
  grid-template-columns: 6.5rem minmax(0, 1fr);
  gap: 1.25rem;
  align-items: center;
}

.now__name,
.now__by {
  margin-top: 0;
  font-size: inherit;
  line-height: inherit;
  letter-spacing: 0;
}

.now__progress {
  margin-top: 0.6rem;
}

.figures {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 2rem;
}

.figure,
.figure + .figure {
  display: flex;
  align-items: baseline;
  gap: 0.3em;
  padding: 0;
  border-left: 0;
}

.figure__v {
  order: 1;
  font-size: inherit;
  line-height: inherit;
  letter-spacing: 0;
}

.figure__t {
  order: 2;
  margin-top: 0;
}

.figure__d {
  order: 3;
}

@media (max-width: 34rem) {
  .now {
    grid-template-columns: 5rem minmax(0, 1fr);
    gap: 1rem;
  }
}

.range__bar {
  border-bottom: 0;
  background: var(--color-bg);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
