/* oomoo -- the music page. Same bones as css/voicemail/voicemail.css: this file is the
 * page, the imports are the whole dependency list -- tokens first so everything after can
 * read --ink, --dim and --text -- and the column is the voicemail page's column.
 */

@import url('../tokens.css');
@import url('../reset.css');
@import url('../utilities.css');
@import url('../home/fonts.css');

/* ------------------------------------------------------------------- Page */

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'National Park', system-ui, sans-serif;
  min-height: 100svh;
}

.label {
  text-transform: uppercase;
  font-family: 'National Park', system-ui, sans-serif;
}

.back {
  position: fixed;
  top: 14px;
  left: 14px;
  font-size: 11px;
  color: var(--dim);
  text-decoration: none;
  z-index: 2;
}

.back:hover {
  color: var(--accent);
}

.stage {
  max-width: 680px;
  margin: 0 auto;
  padding: 64px 18px 48px;
}

.stage__masthead {
  text-align: center;
  margin-bottom: 28px;
}

.stage__title {
  font-family: 'Terminal Grotesque', 'National Park', sans-serif;
  font-size: clamp(2.6rem, 9vw, 4.5rem);
  line-height: 1;
  color: var(--ink);
}

.stage__sub {
  margin-top: 6px;
  font-size: 0.85rem;
  color: var(--dim);
}

/* ---------------------------------------------------------------- The unit */

/* The iPod. Screen and keys are real regions of the photograph, pinned by percentage
 * coordinates measured off the 570x670 scan -- the answering machine's glass trick.
 * Everything painted ON the photo uses hard-coded iPod-LCD values and ignores the
 * theme; everything around it reads the site tokens as usual. */

.jukebox {
  display: grid;
  gap: 18px;
}

.ipod {
  position: relative;
  margin: 0 auto;
  max-width: 340px; /* near the scan's native 312px: dithered art hates being stretched */
}

.ipod__img {
  display: block;
  width: 100%;
  height: auto;
}

/* ----------------------------------------------------------------- Screen */

/* The display window: the light rectangle inside the bezel, x 36-288 / y 31-205. */
.screen {
  position: absolute;
  left: 11.5%;
  top: 7.2%;
  width: 76.9%;
  height: 34.6%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #ccd3dc;
  color: #223468;
  font-family: 'National Park', system-ui, sans-serif;
}

.screen__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  padding: 2px 6px;
  background: linear-gradient(#eef2f6, #b9c4d2);
  border-bottom: 1px solid #8d9bb0;
  font-size: clamp(7px, 1.9vw, 10px);
  font-weight: 700;
}

.screen__loop {
  position: relative;
  display: flex;
  background: none;
  border: 0;
  padding: 1px;
  color: #223468;
  cursor: pointer;
}

.screen__loop-icon {
  width: clamp(8px, 2.2vw, 12px);
  height: clamp(8px, 2.2vw, 12px);
}

.screen__loop-badge {
  display: none;
  position: absolute;
  top: -3px;
  right: -4px;
  font-size: clamp(6px, 1.6vw, 8px);
  line-height: 1;
  font-weight: 700;
}

.screen__loop[data-mode='one'] .screen__loop-badge {
  display: block;
}

/* Cover Flow, shrunk onto the LCD. The transforms that fan the sleeves out are
 * jukebox.js's job (sized off the flow's own width, so the same math fits any screen);
 * this file owns the room they stand in. */
.screen__flow {
  position: relative;
  flex: 1;
  min-height: 0;
  perspective: 320px;
  overflow: hidden;
}

.flow__sleeve {
  position: absolute;
  left: 50%;
  top: 50%;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  transition: transform 0.45s ease;
  transform-style: preserve-3d;
}

.flow__cover {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: brightness(0.55) saturate(0.8);
  transition: filter 0.45s ease;
}

.flow__sleeve--front .flow__cover {
  filter: none;
}

/* The blank sleeve, for a song that never got art. */
.flow__cover--blank {
  display: grid;
  place-items: center;
  background: #aab6c6;
  color: #223468;
  font-size: 1.4rem;
}

/* The Finder's filename line, in the LCD voice. */
.screen__songtitle {
  flex-shrink: 0;
  text-align: center;
  padding: 1px 6px 2px;
  font-size: clamp(7px, 2vw, 11px);
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.screen__foot {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
  padding: 2px 6px 3px;
  border-top: 1px solid #8d9bb0;
}

.screen__clock {
  font-size: clamp(6px, 1.8vw, 9px);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.screen__groove {
  flex: 1;
  height: 8px;
  border: 1px solid #8d9bb0;
  background: #e7ebf1;
  cursor: pointer;
  touch-action: none; /* the groove owns horizontal drags */
}

.screen__fill {
  height: 100%;
  width: 0;
  background: linear-gradient(#9db9e6, #5c85cc);
}

/* ------------------------------------------------------------- Wheel keys */

/* Invisible hotspots over the wheel's printed glyphs. Each holds a mask image cut from
 * the photograph's own glyph pixels (scripts in the repo history; the masks live next
 * to the scan), so hovering repaints exactly the printed pixels in ink -- red in both
 * themes -- with nothing drawn on top at rest. */
.wheel-key {
  position: absolute;
  width: 14.1%; /* the 44x28 mask box, as a fraction of the 312x515 scan */
  height: 5.44%;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

.wheel-key__ink {
  position: absolute;
  inset: 0;
  background: var(--ink);
  -webkit-mask: var(--glyph) center / 100% 100% no-repeat;
  mask: var(--glyph) center / 100% 100% no-repeat;
  opacity: 0;
  transition: opacity 0.12s ease;
}

.wheel-key:hover .wheel-key__ink,
.wheel-key:focus-visible .wheel-key__ink {
  opacity: 1;
}

/* Mask boxes measured off the scan: |<< (59,350)  >>| (206,348)  >|| (133,427). */
.wheel-key--prev { left: 18.91%; top: 67.96%; }
.wheel-key--next { left: 66.03%; top: 67.57%; }
.wheel-key--play { left: 42.63%; top: 82.91%; }

.jukebox__nojs-player {
  display: block;
  width: min(100%, 34rem);
  margin: 0 auto;
}

.jukebox__nojs {
  text-align: center;
  font-size: 0.75rem;
  color: var(--dim);
}



.setlist__empty {
  text-align: center;
  color: var(--dim);
  font-size: 0.85rem;
}

.stage__foot {
  margin-top: 52px;
  text-align: center;
  color: var(--dim);
  font-size: 0.75rem;
  font-style: italic;
}

/* -------------------------------------------------------------- The caption */

/* One caption per song rides below the unit, like the filename under Finder's flow;
 * jukebox.js keeps exactly one switched on. */

.caption {
  display: none;
  text-align: center;
}

.caption--on {
  display: block;
}

.caption__name {
  color: var(--ink);
  font-size: 1.15rem;
}

.caption__meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 6px 10px;
  margin-top: 4px;
  font-size: 10px;
  color: var(--dim);
}

.caption__tag {
  border: 1px solid var(--line);
  padding: 1px 6px;
}

.song__edit {
  background: none;
  border: 0;
  color: var(--dim);
  font: inherit;
  cursor: pointer;
  padding: 0;
}

.song__edit:hover {
  color: var(--accent);
}

/* Descriptions are markdown in the /now arrangement: small prose, pulled back a step.
 * Left-aligned against the caption's centered chrome: a description can run long-form,
 * and centered prose stops being readable after the second line. */
.caption__desc {
  max-width: 34rem;
  margin: 8px auto 0;
  font-size: 0.85rem;
  line-height: 1.5;
  text-align: left;
  color: color-mix(in oklab, var(--text) 72%, transparent);
}

.caption__desc p {
  margin: 0.4rem 0;
}

/* ------------------------------------------------------------------- Rest */

.jukebox__nojs-player {
  display: block;
  width: min(100%, 34rem);
  margin: 0 auto;
}

.jukebox__nojs {
  text-align: center;
  font-size: 0.75rem;
  color: var(--dim);
}

.setlist__empty {
  text-align: center;
  color: var(--dim);
  font-size: 0.85rem;
}

.stage__foot {
  margin-top: 52px;
  text-align: center;
  color: var(--dim);
  font-size: 0.75rem;
  font-style: italic;
}

/* ------------------------------------------------------------------ Admin */

/* Same voice as the moos' controls -- small labels, hairline dialogs. Only ever rendered
 * into the page for an admin session. */

.admin-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  border: 1px dashed var(--accent);
  padding: 8px 12px;
  margin-bottom: 1.5rem;
  font-size: 10px;
}

.admin-bar button {
  background: none;
  border: 0;
  color: var(--dim);
  font: inherit;
  text-transform: inherit;
  cursor: pointer;
  padding: 2px 0;
}

.admin-bar button:hover {
  color: var(--accent);
}

.dlg {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--accent);
  padding: 18px;
  width: min(32rem, calc(100vw - 28px));
}

.dlg::backdrop {
  background: rgb(0 0 0 / 0.6);
}

.dlg__form {
  display: grid;
  gap: 10px;
}

.dlg__form h2 {
  font-size: 11px;
  color: var(--accent);
}

.dlg__row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.dlg__input {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
  font-family: 'National Park', system-ui, sans-serif;
  font-size: 12px;
  padding: 6px 8px;
}

.dlg__input:focus {
  outline: 1px solid var(--accent);
  outline-offset: 1px;
}

textarea.dlg__input {
  font-size: 0.9rem;
  resize: vertical;
}

.dlg__file {
  font-size: 10px;
  color: var(--dim);
}

.dlg__file input {
  font: inherit;
  color: inherit;
  max-width: 14rem;
}

.dlg__check {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  color: var(--dim);
}

.dlg__actions {
  justify-content: flex-end;
}

.dlg__actions button {
  background: none;
  border: 1px solid var(--line);
  color: var(--text);
  font: inherit;
  font-size: 10px;
  padding: 5px 12px;
  cursor: pointer;
}

.dlg__actions button:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

.dlg__actions button:disabled {
  opacity: 0.4;
  cursor: default;
}

.dlg__delete {
  margin-right: auto;
  color: var(--dim);
}

.dlg__error {
  font-family: 'National Park', system-ui, sans-serif;
  font-size: 10px;
  color: var(--accent);
}
