/* The AI Advent Calendar / AI-julekalenderen: the music UI. player.js builds the markup, this file only styles it. Tokens from tokens.css.
   .jkp-*  the header music button + the floating mini player: one light card (the shell's --surface) with the controls;
           the track list and the sing-along lyrics fold out of the same card
   .jks-*  the sing-along card in door 24: the same light card, its lyrics folded behind a quiet "Sing along" link
   Motion is calm (colour, opacity and folding only) and switched off under prefers-reduced-motion. */

/* ---------- Equalizer bars (shared, in currentColor) ---------- */
.jkp-eq { display: flex; align-items: flex-end; justify-content: center; gap: 3px; width: 18px; height: 16px; }
.jkp-eq i { --d: 0s; display: block; width: 3px; height: 100%; border-radius: 2px; background: currentColor; transform-origin: 50% 100%; transform: scaleY(.38); }
.jkp-eq i:nth-child(2) { --d: -.7s; transform: scaleY(.72); }
.jkp-eq i:nth-child(3) { --d: -.3s; transform: scaleY(.52); }
@keyframes jkp-eq {
  0%, 100% { transform: scaleY(.38); }
  30% { transform: scaleY(.92); }
  60% { transform: scaleY(.56); }
  80% { transform: scaleY(.8); }
}

/* ---------- Header button: the note turns into equalizer bars while the music plays ---------- */
.jk-btn.jkp-btn { position: relative; }
.jkp-ico { position: relative; display: grid; place-items: center; width: 22px; height: 22px; }
.jkp-ico > * { grid-area: 1 / 1; transition: opacity var(--t-med) var(--ease-out), transform var(--t-med) var(--ease-out); }
.jk-btn .jkp-ico svg { width: 22px; height: 22px; }
.jkp-ico .jkp-eq { opacity: 0; transform: scale(.6); }
.jk-btn.jkp-btn[aria-pressed="true"] { background: rgba(245, 245, 247, .16); }
.jk-btn.jkp-btn[aria-pressed="true"] .jkp-ico svg { opacity: 0; transform: scale(.6); }
.jk-btn.jkp-btn[aria-pressed="true"] .jkp-ico .jkp-eq { opacity: 1; transform: none; }
[aria-pressed="true"] > .jkp-ico .jkp-eq i, [data-playing="1"] .jkp-eq i { animation: jkp-eq 1.6s ease-in-out var(--d) infinite; }

/* ---------- The floating mini player ---------- */
.jkp-root {
  position: fixed; left: 0; right: 0; bottom: calc(var(--s-3) + var(--safe-b)); z-index: 80;
  display: flex; flex-direction: column; align-items: center; padding-inline: var(--s-2); pointer-events: none;
  color: var(--paper-ink); font-family: var(--font-text); color-scheme: light;
  visibility: visible; opacity: 1; transform: none;
  transition: opacity var(--t-med) var(--ease-out), transform var(--t-med) var(--ease-out), visibility 0s;
}
.jkp-root[data-state="hidden"], .module-focus .jkp-root {
  visibility: hidden; opacity: 0; transform: translateY(16px);
  transition: opacity var(--t-med) var(--ease-out), transform var(--t-med) var(--ease-out), visibility 0s linear var(--t-med);
}
.jkp-root[data-state="min"] .jkp-pill { display: none; }
.jkp-root[data-state="open"] .jkp-dot { display: none; }
.jkp-root > * { pointer-events: auto; }
.jkp-root [hidden] { display: none !important; }
.jkp-root :focus-visible { outline-color: var(--paper-red); }
.jkp-root ::selection { background: rgba(225, 29, 46, .16); }

/* The card: borderless, the shell's light surface, 28 px corners, a soft shadow so it floats over night and paper alike */
.jkp-pill {
  position: relative; width: min(100%, 560px);
  border-radius: var(--r-xl); background: var(--surface); color: var(--paper-ink); box-shadow: var(--shadow-2);
}

.jkp-row {
  position: relative; display: grid; align-items: center; column-gap: 2px; padding: var(--s-2);
  grid-template-columns: minmax(0, 1fr) repeat(3, auto);
  grid-template-areas: "meta prev play next" "sing sing sing sing";
}
.jkp-meta { grid-area: meta; }
.jkp-prev { grid-area: prev; }
.jkp-play { grid-area: play; }
.jkp-next { grid-area: next; }
.jkp-sing { grid-area: sing; }
.jkp-close { grid-area: close; }

/* Album art: a small white tile with the track's 3D illustration (the note icon until it loads) */
.jkp-art {
  position: relative; flex: none; display: grid; place-items: center; width: 40px; height: 40px; overflow: hidden;
  border-radius: var(--r-sm); background: var(--paper); color: var(--paper-ink-3);
}
.jkp-art > * { grid-area: 1 / 1; transition: opacity var(--t-med) var(--ease-out); }
.jkp-art svg { width: 20px; height: 20px; }
.jkp-art img { display: block; width: 100%; height: 100%; padding: 3px; object-fit: contain; opacity: 0; }
.jkp-art.has img { opacity: 1; }
.jkp-art.has svg { opacity: 0; }

/* Title + composer: one button that opens the track list */
.jkp-meta {
  min-width: 0; display: flex; align-items: center; gap: 12px; min-height: 48px; margin: 0; padding: 4px 8px 4px 4px;
  border: 0; border-radius: var(--r-lg); background: transparent; color: inherit; text-align: start;
  transition: background-color var(--t-fast);
}
.jkp-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.jkp-title { font-size: var(--fs-small); font-weight: 600; line-height: 1.25; letter-spacing: -.01em; color: var(--paper-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.jkp-sub { font-size: var(--fs-fine); line-height: 1.3; color: var(--paper-ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.jkp-more { flex: none; display: grid; place-items: center; width: 18px; height: 18px; color: var(--paper-ink-3); transition: transform var(--t-med) var(--ease-out), color var(--t-fast); }
.jkp-more svg { width: 16px; height: 16px; }
.jkp-meta[aria-expanded="true"] .jkp-more { color: var(--paper-ink); }
.jkp-meta[aria-expanded="true"] .jkp-more { transform: rotate(180deg); }

/* Round icon buttons; play is the one solid red circle */
.jkp-b {
  flex: none; display: inline-grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%;
  background: transparent; color: var(--paper-ink);
  transition: background-color var(--t-fast), color var(--t-fast), transform var(--t-fast) var(--ease-out);
}
.jkp-b:active { transform: scale(.94); }
.jkp-b svg { width: 22px; height: 22px; }
.jkp-prev svg, .jkp-next svg { width: 20px; height: 20px; }
.jkp-b[disabled] { opacity: .4; pointer-events: none; }
.jkp-play { background: var(--red); color: var(--snow); }
.jkp-play svg { width: 20px; height: 20px; }
.jkp-close { display: none; color: var(--paper-ink-3); }

/* "Sing along": a quiet text link with a chevron (the lyrics fold out upwards); on phones a second line under the title */
.jkp-sing {
  justify-self: start; display: inline-flex; align-items: center; gap: 2px; min-height: 32px; margin: -6px 0 -2px 56px; padding: 0 6px 0 0;
  border: 0; border-radius: var(--r-sm); background: none; color: var(--paper-ink-3);
  font-size: var(--fs-fine); font-weight: 600; line-height: 1.2; white-space: nowrap;
  transition: color var(--t-fast);
}
.jkp-sing[aria-expanded="true"] { color: var(--paper-ink); }
.jkp-chev { display: grid; place-items: center; width: 16px; height: 16px; transition: transform var(--t-med) var(--ease-out); }
.jkp-chev svg { width: 16px; height: 16px; }
.jkp-sing[aria-expanded="true"] .jkp-chev { transform: rotate(180deg); }

/* Thin progress line along the bottom edge */
.jkp-clip { position: absolute; inset: 0; overflow: hidden; border-radius: inherit; pointer-events: none; }
.jkp-prog { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: rgba(0, 0, 0, .06); }
.jkp-prog i { display: block; height: 100%; background: var(--red); transform-origin: 0 50%; transform: scaleX(var(--p, 0)); }

/* Make smaller: a small round button just above the card's corner */
.jkp-fold {
  position: absolute; right: var(--s-3); bottom: calc(100% + var(--s-2)); display: grid; place-items: center; width: 32px; height: 32px; padding: 0;
  border: 0; border-radius: 50%; background: var(--surface); color: var(--paper-ink-2); box-shadow: var(--shadow-1);
  transition: color var(--t-fast), transform var(--t-fast) var(--ease-out);
}
.jkp-fold::after { content: ""; position: absolute; inset: -6px; border-radius: 50%; }
.jkp-fold:active { transform: scale(.94); }
.jkp-fold svg { width: 18px; height: 18px; }

/* The folded-away player: one round button in the corner */
.jkp-dot {
  position: fixed; right: var(--s-4); bottom: calc(var(--s-4) + var(--safe-b)); display: grid; place-items: center; width: 52px; height: 52px; padding: 0;
  border: 0; border-radius: 50%; background: var(--surface); color: var(--paper-ink); box-shadow: var(--shadow-2);
  transition: transform var(--t-fast) var(--ease-out);
}
.jkp-dot:active { transform: scale(.94); }
.jkp-dot > * { grid-area: 1 / 1; transition: opacity var(--t-med) var(--ease-out), transform var(--t-med) var(--ease-out); }
.jkp-dot svg { width: 24px; height: 24px; }
.jkp-dot .jkp-eq { opacity: 0; transform: scale(.6); color: var(--red); }
.jkp-dot[data-playing="1"] svg { opacity: 0; transform: scale(.6); }
.jkp-dot[data-playing="1"] .jkp-eq { opacity: 1; transform: none; }

/* ---------- The panel that folds out of the card above the controls: sing-along lyrics or the track list ---------- */
.jkp-panel { display: grid; grid-template-rows: 0fr; transition: grid-template-rows var(--t-slow) var(--ease-out); }
.jkp-root[data-panel="lyrics"] .jkp-panel, .jkp-root[data-panel="list"] .jkp-panel { grid-template-rows: 1fr; }
.jkp-panel-in {
  min-height: 0; overflow: hidden; visibility: hidden; opacity: 0;
  transition: opacity var(--t-med) var(--ease-out), visibility 0s linear var(--t-slow);
}
.jkp-root[data-panel="lyrics"] .jkp-panel-in, .jkp-root[data-panel="list"] .jkp-panel-in {
  visibility: visible; opacity: 1;
  transition: opacity var(--t-slow) var(--ease-out), visibility 0s;
}

/* Lyrics: bold system-font lines; the line being sung turns dark and its syllables light up red as they are sung */
.jkp-lyr-box {
  position: relative; max-height: min(34vh, 244px); overflow-y: auto; overscroll-behavior: contain; padding: var(--s-6) var(--s-6) var(--s-3);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, var(--paper-ink) 26px, var(--paper-ink) calc(100% - 18px), transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0, var(--paper-ink) 26px, var(--paper-ink) calc(100% - 18px), transparent 100%);
  scrollbar-width: none;
}
.jkp-lyr-box::-webkit-scrollbar { display: none; }
.jkp-line {
  margin: 0; padding: 3px 0; color: var(--paper-ink-3); text-wrap: balance;
  font-family: var(--font-display); font-size: var(--fs-lg); font-weight: 700; line-height: 1.3; letter-spacing: -.014em;
  transition: color var(--t-med) var(--ease-out);
}
.jkp-line.gap { margin-top: var(--s-4); }
.jkp-line.on { color: var(--paper-ink); }
.jkp-line.on:not(:has(.jkp-syl)) { color: var(--paper-red); }
.jkp-syl { transition: color 120ms linear; }
.jkp-line.on .jkp-syl.sung { color: var(--paper-red); }
.jkp-empty { margin: 0; color: var(--paper-ink-3); font-size: var(--fs-small); }

/* Track list */
.jkp-list { display: flex; flex-direction: column; max-height: min(58vh, 460px); padding-top: var(--s-2); }
.jkp-head { flex: none; margin: 0; padding: var(--s-4) var(--s-6) var(--s-2); font-size: var(--fs-fine); font-weight: 700; color: var(--paper-ink-3); }
.jkp-scroll {
  position: relative; flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0 var(--s-2);
  scrollbar-width: thin; scrollbar-color: var(--paper-line-2) transparent;
}
.jkp-tracks { list-style: none; margin: 0; padding: 0; }
.jkp-track {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 52px; margin: 0; padding: 6px 14px 6px 8px;
  border: 0; border-radius: var(--r-md); background: transparent; color: var(--paper-ink); text-align: start;
  transition: background-color var(--t-fast);
}
.jkp-track.cur { background: var(--paper); }
.jkp-track.cur .jkp-art { background: var(--surface); }
.jkp-ttext { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.jkp-tname { font-size: var(--fs-small); font-weight: 600; line-height: 1.25; letter-spacing: -.01em; color: var(--paper-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.jkp-track.cur .jkp-tname { color: var(--paper-red); }
.jkp-tsub { font-size: var(--fs-fine); line-height: 1.3; color: var(--paper-ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.jkp-tend { flex: none; display: flex; align-items: center; gap: 10px; color: var(--paper-ink-3); font-size: var(--fs-fine); font-variant-numeric: tabular-nums; }
.jkp-tag { display: grid; place-items: center; }
.jkp-tag svg { width: 15px; height: 15px; }
.jkp-tdur { min-width: 2.6em; text-align: end; }
.jkp-track .jkp-eq { display: none; width: 2.6em; height: 14px; gap: 2px; color: var(--paper-red); }
.jkp-track .jkp-eq i { width: 2.5px; }
.jkp-track[data-playing="1"] .jkp-eq { display: flex; }
.jkp-track[data-playing="1"] .jkp-tdur { display: none; }

.jkp-foot { flex: none; display: flex; flex-wrap: wrap; gap: var(--s-2); padding: var(--s-3) var(--s-4) 0; }
.jkp-chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 var(--s-4) 0 var(--s-3); border: 0; border-radius: var(--r-pill);
  background: rgba(0, 0, 0, .05); color: var(--paper-ink); font-size: var(--fs-fine); font-weight: 600;
  transition: background-color var(--t-fast), color var(--t-fast), transform var(--t-fast) var(--ease-out);
}
.jkp-chip:active { transform: scale(.97); }
.jkp-chip-ico { display: grid; place-items: center; }
.jkp-chip svg { width: 18px; height: 18px; }
.jkp-sfx[aria-pressed="false"] { color: var(--paper-ink-3); }
.jkp-credit { flex: none; margin: 0; padding: var(--s-3) var(--s-6) var(--s-1); font-size: .6875rem; line-height: 1.45; color: var(--paper-ink-3); }

/* Phones: the title may take two lines (no composer line); the smallest screens drop "previous" (it is in the list) */
@media (max-width: 479px) {
  .jkp-meta { gap: 10px; padding-inline-end: 4px; }
  .jkp-title { white-space: normal; overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; }
  .jkp-sub, .jkp-more { display: none; }
  .jkp-sing { margin-inline-start: 54px; }
}
@media (max-width: 359px) { .jkp-prev { display: none; } }
/* Wider screens: one row, the sing-along link and a close button inline */
@media (min-width: 640px) {
  .jkp-pill { width: min(100%, 680px); }
  .jkp-row { grid-template-columns: minmax(0, 1fr) repeat(5, auto); grid-template-areas: "meta prev play next sing close"; }
  .jkp-sing { min-height: 44px; margin: 0 2px 0 10px; padding: 0 6px; }
  .jkp-close { display: inline-grid; }
}

/* ---------- The sing-along card (door 24) ---------- */
.jks-card { position: relative; padding: clamp(24px, 4vw, 36px); border-radius: var(--r-xl); background: var(--surface); color: var(--paper-ink); }
.jks-head { display: flex; align-items: center; gap: var(--s-5); }
.jks-play {
  flex: none; display: grid; place-items: center; width: 56px; height: 56px; padding: 0; border: 0; border-radius: 50%;
  background: var(--red); color: var(--snow);
  transition: background-color var(--t-fast), transform var(--t-fast) var(--ease-out);
}
.jks-play:active { transform: scale(.95); }
.jks-play[disabled] { opacity: .45; pointer-events: none; }
.jks-play svg { width: 24px; height: 24px; }
.jks-titles { flex: 1 1 auto; min-width: 0; }
.jks-eyebrow { margin: 0; font-size: var(--fs-fine); font-weight: 600; line-height: 1.3; color: var(--paper-ink-3); }
.jks-title { margin: 4px 0 0; font-size: var(--fs-h2); line-height: 1.1; color: var(--paper-ink); overflow-wrap: anywhere; }
.jks-toggle {
  display: inline-flex; align-items: center; gap: 2px; min-height: 32px; margin: 4px 0 -8px; padding: 0 4px 0 0;
  border: 0; border-radius: var(--r-sm); background: none; color: var(--paper-ink-3);
  font-size: var(--fs-small); font-weight: 600; line-height: 1.2;
  transition: color var(--t-fast);
}
.jks-toggle[aria-expanded="true"] { color: var(--paper-ink); }
.jks-toggle svg { width: 18px; height: 18px; transition: transform var(--t-med) var(--ease-out); }
.jks-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }
.jks-note { margin: var(--s-4) 0 0; font-size: var(--fs-small); color: var(--paper-ink-2); }
.jks-note:empty { display: none; }

.jks-fold { display: grid; grid-template-rows: 0fr; transition: grid-template-rows var(--t-slow) var(--ease-out); }
.jks-card.open .jks-fold { grid-template-rows: 1fr; }
.jks-fold-in {
  min-height: 0; overflow: hidden; visibility: hidden; opacity: 0;
  transition: opacity var(--t-med) var(--ease-out), visibility 0s linear var(--t-slow);
}
.jks-card.open .jks-fold-in { visibility: visible; opacity: 1; transition: opacity var(--t-slow) var(--ease-out), visibility 0s; }

.jks-lyrics {
  position: relative; margin-top: var(--s-5); max-height: 320px; overflow-y: auto; overscroll-behavior: contain; padding: var(--s-4) 0;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, var(--paper-ink) 22px, var(--paper-ink) calc(100% - 22px), transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0, var(--paper-ink) 22px, var(--paper-ink) calc(100% - 22px), transparent 100%);
  scrollbar-width: thin; scrollbar-color: var(--paper-line-2) transparent;
}
.jks-line {
  margin: 0; padding: 3px 0; color: var(--paper-ink-2); text-wrap: pretty;
  font-family: var(--font-display); font-size: var(--fs-lg); font-weight: 700; line-height: 1.35; letter-spacing: -.012em;
  transition: color var(--t-med) var(--ease-out);
}
.jks-line.gap { margin-top: var(--s-4); }
.jks-card:where([data-playing="1"]) .jks-line { color: var(--paper-ink-3); }
.jks-line.on { color: var(--paper-ink); }
.jks-line.on:not(:has(.jks-syl)) { color: var(--paper-red); }
.jks-syl { transition: color 120ms linear; }
.jks-line.on .jks-syl.sung { color: var(--paper-red); }
.jks-empty { margin: 0; color: var(--paper-ink-3); font-size: var(--fs-small); }
.jks-credit { margin: var(--s-4) 0 0; font-size: var(--fs-xs); line-height: 1.45; color: var(--paper-ink-3); }

@media (max-width: 420px) {
  .jks-head { gap: var(--s-4); }
  .jks-play { width: 52px; height: 52px; }
}

/* ---------- Hover: pointer devices only, so nothing stays lit after a tap ---------- */
@media (hover: hover) {
  .jkp-meta:hover, .jkp-track:hover { background: rgba(0, 0, 0, .04); }
  .jkp-track.cur:hover { background: var(--paper); }
  .jkp-meta:hover .jkp-more, .jkp-close:hover, .jkp-fold:hover, .jkp-sing:hover, .jks-toggle:hover { color: var(--paper-ink); }
  .jkp-b:hover { background: rgba(0, 0, 0, .05); }
  .jkp-play:hover, .jks-play:hover { background: var(--red-hi); }
  .jkp-chip:hover { background: rgba(0, 0, 0, .08); }
}

/* ---------- Reduced motion: nothing loops, slides or folds; changes are instant ---------- */
@media (prefers-reduced-motion: reduce) {
  .jkp-eq i, [aria-pressed="true"] > .jkp-ico .jkp-eq i, [data-playing="1"] .jkp-eq i { animation: none !important; }
  .jkp-root, .jkp-root[data-state="hidden"], .module-focus .jkp-root { transform: none; transition: none; }
  .jkp-panel, .jkp-panel-in, .jkp-root[data-panel] .jkp-panel-in, .jks-fold, .jks-fold-in, .jks-card.open .jks-fold-in,
  .jkp-ico > *, .jkp-dot > *, .jkp-art > *, .jkp-more, .jkp-chev, .jks-toggle svg,
  .jkp-line, .jkp-syl, .jks-line, .jks-syl { transition: none; }
  .jkp-b:active, .jkp-chip:active, .jkp-dot:active, .jkp-fold:active, .jks-play:active { transform: none; }
}
