/* Chad Twedt site-wide music player. Uses the site's tokens when present, with fallbacks so it
   also works on the Cerebroom blog. */
#tp, .tp-launch {
  --tp-bg: rgba(22, 7, 5, .96);
  --tp-line: var(--line, #4a2420);
  --tp-text: var(--text, #e9cbc3);
  --tp-muted: var(--muted, #b48c84);
  --tp-gold: var(--gold, #ffe46b);
  --tp-red: var(--tab, #b4281e);
  --tp-hot: var(--tab-hot, #f01405);
  --tp-display: var(--f-display, "Oswald", "Arial Narrow", Arial, sans-serif);
  --tp-body: var(--f-body, "Source Sans 3", "Segoe UI", Arial, sans-serif);
  font: 400 1rem/1.4 var(--tp-body); color: var(--tp-text);
}
#tp [hidden], .tp-launch[hidden] { display: none !important; }
:where(#tp, .tp-launch) button {
  font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer;
  display: inline-grid; place-items: center;
}
#tp svg, .tp-launch svg { flex: none; width: 22px; height: 22px; fill: currentColor; }
#tp button:focus-visible, .tp-launch button:focus-visible, #tp input:focus-visible, .tp-launch input:focus-visible,
#tp a:focus-visible { outline: 2px solid var(--tp-gold); outline-offset: 2px; border-radius: 6px; }

/* Vertical volume slider (native control turned on its side) */
.tp-volwrap { display: grid; justify-items: center; gap: 4px; color: var(--tp-muted); }
.tp-volwrap svg { width: 16px !important; height: 16px !important; }
.tp-vol {
  writing-mode: vertical-lr; direction: rtl; -webkit-appearance: slider-vertical;
  width: 20px; height: 74px; margin: 0; accent-color: var(--tp-red); cursor: pointer;
}

/* ---------- 1. Launcher: play + volume, sitting in the page ---------- */
.tp-launch {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 12px 10px 14px; border-radius: 22px;
  background: rgba(14, 5, 4, .82); border: 1px solid var(--tp-line);
  box-shadow: 10px 12px 18px rgba(0,0,0,.85), inset 0 1px 0 rgba(255,220,200,.07);
  backdrop-filter: blur(4px);
}
.tp-launch .tp-bigplay { grid-row: 1; }
.tp-launch { display: grid; grid-template-columns: auto auto; grid-template-rows: auto auto; column-gap: 12px; row-gap: 4px; }
.tp-launch .tp-volwrap { grid-column: 2; grid-row: 1 / 3; }
.tp-launch-label {
  grid-column: 1; grid-row: 2; justify-self: center;
  font: 500 .78rem/1 var(--tp-display); letter-spacing: .2em; text-transform: uppercase; color: var(--tp-gold);
}
.tp-bigplay {
  width: 60px; height: 60px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #e0402f, var(--tp-red) 55%, #6d140d) !important;
  color: #120403 !important;
  box-shadow: 0 6px 12px rgba(0,0,0,.8), inset 0 2px 1px rgba(255,180,160,.35), inset 0 -3px 6px rgba(0,0,0,.45);
  transition: transform .2s ease, box-shadow .2s ease;
}
.tp-bigplay svg { width: 30px !important; height: 30px !important; margin-left: 3px; }
.tp-bigplay:hover { transform: scale(1.06); box-shadow: 0 8px 16px rgba(0,0,0,.85), 0 0 18px rgba(240,20,5,.45), inset 0 2px 1px rgba(255,180,160,.35); }
.tp-launch.tp-float { position: fixed; right: max(16px, env(safe-area-inset-right, 0px)); bottom: max(16px, env(safe-area-inset-bottom, 0px)); z-index: 40; }

/* ---------- 2. Full player ---------- */
.tp-full {
  position: fixed; z-index: 50;
  right: max(18px, env(safe-area-inset-right, 0px)); bottom: max(18px, env(safe-area-inset-bottom, 0px));
  width: min(430px, calc(100vw - 32px)); max-height: calc(100dvh - 36px);
  display: flex; flex-direction: column; gap: 12px;
  padding: 16px 18px 12px; border-radius: 26px;
  background: var(--tp-bg); border: 1px solid var(--tp-line);
  box-shadow: 16px 18px 34px rgba(0,0,0,.9), inset 0 1px 0 rgba(255,220,200,.07);
  backdrop-filter: blur(8px);
}
.tp-head { display: flex; align-items: center; justify-content: space-between; }
.tp-kicker { font: 500 .8rem/1 var(--tp-display); letter-spacing: .2em; text-transform: uppercase; color: var(--tp-muted); }
.tp-minbtn {
  display: inline-flex !important; align-items: center; gap: 6px;
  font: 600 .85rem/1 var(--tp-display) !important; letter-spacing: .12em; text-transform: uppercase;
  padding: 9px 14px 9px 10px !important; border-radius: 999px; border: 1px solid var(--tp-red) !important;
  background: var(--tp-red) !important; color: #120403 !important;
  box-shadow: 0 4px 10px rgba(0,0,0,.6);
}
.tp-minbtn:hover { background: var(--tp-hot) !important; }

.tp-now { display: grid; grid-template-columns: 132px minmax(0, 1fr); gap: 16px; align-items: start; }
.tp-art { position: relative; display: block; width: 132px; height: 132px; border-radius: 8px; overflow: hidden;
  box-shadow: 8px 10px 16px rgba(0,0,0,.85); }
.tp-art img { display: block; width: 100%; height: 100%; object-fit: cover; }
a.tp-art span {
  position: absolute; inset: auto 0 0; padding: 6px 4px; text-align: center;
  font: 600 .72rem/1 var(--tp-display); letter-spacing: .12em; text-transform: uppercase;
  background: rgba(10,3,2,.82); color: var(--tp-gold);
  transform: translateY(100%); transition: transform .2s ease;
}
a.tp-art:hover span, a.tp-art:focus-visible span { transform: none; }
.tp-meta { min-width: 0; display: grid; gap: 6px; align-content: start; }
.tp-title { margin: 0; font: 600 1.08rem/1.25 var(--tp-body); color: var(--tp-gold); }
.tp-comp { margin: 0; font-size: .95rem; color: var(--tp-text); }
.tp-count { margin: 0; font: 500 .78rem/1.2 var(--tp-display); letter-spacing: .1em; text-transform: uppercase; color: var(--tp-muted); }
.tp-note { margin: 0; font-size: .86rem; font-style: italic; color: var(--tp-text); }
.tp-live { display: block; font-size: .86rem; line-height: 1.35; color: var(--tp-muted); }
.tp-live b {
  display: inline-flex; align-items: center; gap: 6px; margin-right: 4px;
  font: 600 .72rem/1 var(--tp-display); letter-spacing: .14em; text-transform: uppercase; color: var(--tp-gold);
}
.tp-live b::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--tp-hot); box-shadow: 0 0 6px var(--tp-hot); }

.tp-seek { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px;
  font: 500 .8rem/1 var(--tp-display); letter-spacing: .05em; color: var(--tp-muted); }
.tp-pos { width: 100%; margin: 0; accent-color: var(--tp-red); cursor: pointer; }

.tp-ctrls { display: flex; align-items: center; gap: 6px; }
.tp-ctrls button { width: 40px; height: 40px; border-radius: 50%; color: var(--tp-text); transition: background .2s, color .2s; }
.tp-ctrls button:hover { background: rgba(255,255,255,.07); color: var(--tp-gold); }
.tp-ctrls .tp-pp { width: 48px; height: 48px; background: var(--tp-red); color: #120403; box-shadow: 0 4px 10px rgba(0,0,0,.7); }
.tp-ctrls .tp-pp:hover { background: var(--tp-hot); color: #120403; }
.tp-full .tp-ctrls { justify-content: center; gap: 12px; }
/* in the full player the volume sits horizontally beside the buttons to save height */
.tp-full .tp-vol-h { display: flex; align-items: center; gap: 6px; margin-left: 6px; }
.tp-full .tp-vol-h .tp-vol { writing-mode: horizontal-tb; direction: ltr; -webkit-appearance: auto; width: 90px; height: 20px; }
#tp.tp-blocked .tp-pp { animation: tp-pulse 1.4s ease-in-out infinite; }
@keyframes tp-pulse { 50% { box-shadow: 0 0 0 8px rgba(240,20,5,.25), 0 4px 10px rgba(0,0,0,.7); } }

.tp-listhead { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  border-top: 1px solid var(--tp-line); padding-top: 10px; }
.tp-listhead span:first-child { font: 500 .85rem/1 var(--tp-display); letter-spacing: .2em; text-transform: uppercase; color: var(--tp-gold); }
.tp-listnote { font-size: .78rem; color: var(--tp-muted); }
.tp-list {
  list-style: none; margin: 0 -6px; padding: 0 4px 4px; overflow-y: auto; min-height: 120px; flex: 1;
  scrollbar-width: thin; scrollbar-color: rgba(150,0,0,.8) transparent;
}
.tp-list li { margin: 0; }
/* How works are grouped in the playlist. Two styles; player.js picks one (GROUP_STYLE).
   "brace": a colored bar down the left of each work, alternating red and gold. */
#tp.tp-brace .tp-list li.grp { border-left: 4px solid var(--tp-red); margin-left: 4px; }
#tp.tp-brace .tp-list li.grp.g-alt { border-left-color: var(--tp-gold); }
#tp.tp-brace .tp-list li.g-first { margin-top: 6px; border-top-left-radius: 6px; }
#tp.tp-brace .tp-list li.g-last { margin-bottom: 6px; border-bottom-left-radius: 6px; }
/* "cards": every work and every single piece sits on its own rounded, tinted card, alternating
   red and gold down the list. Thumbnails all line up. */
#tp.tp-cards .tp-list { --card-red: 200, 50, 35; --card-gold: 230, 190, 70; }
#tp.tp-cards .tp-list li.grp, #tp.tp-cards .tp-list li.solo { --c: var(--card-red); }
#tp.tp-cards .tp-list li.g-alt { --c: var(--card-gold); }
#tp.tp-cards .tp-list li.grp, #tp.tp-cards .tp-list li.solo {
  background: linear-gradient(180deg, rgba(var(--c), .16), rgba(var(--c), .09));
  box-shadow: inset 1px 0 0 rgba(var(--c), .22), inset -1px 0 0 rgba(var(--c), .22);
}
#tp.tp-cards .tp-list li.g-first { margin-top: 10px; border-radius: 10px 10px 0 0; box-shadow: inset 0 1px 0 rgba(var(--c), .35), inset 1px 0 0 rgba(var(--c), .22), inset -1px 0 0 rgba(var(--c), .22); }
#tp.tp-cards .tp-list li.g-last { margin-bottom: 10px; border-radius: 0 0 10px 10px; padding-bottom: 4px; box-shadow: inset 0 -1px 0 rgba(var(--c), .22), inset 1px 0 0 rgba(var(--c), .22), inset -1px 0 0 rgba(var(--c), .22); }
#tp.tp-cards .tp-list li.solo { margin: 10px 0; border-radius: 10px; box-shadow: inset 0 0 0 1px rgba(var(--c), .25); }
#tp.tp-cards .tp-list li:first-child { margin-top: 2px; }
/* movements under a work heading sit on a solid, dark version of the card's color */
#tp.tp-cards .tp-list li { --row: #230a07; }
#tp.tp-cards .tp-list li.g-alt { --row: #201a07; }
#tp.tp-cards .tp-list li.tp-l-mv { background: var(--row); }
/* work headings (and single pieces) are the lit part of the card: lit at the top, fading smoothly
   down into the dark of the rows beneath */
#tp.tp-cards .tp-list li.tp-l-work, #tp.tp-cards .tp-list li.solo {
  background: linear-gradient(180deg, rgba(var(--c), .29), rgba(var(--c), 0)), var(--row);
}
/* single pieces' titles match their card, like the work headings */
#tp.tp-cards .tp-list li.solo:not(.g-alt) .tp-l-t { color: var(--link, #ff6a58); }
#tp.tp-cards .tp-list li.solo.g-alt .tp-l-t { color: var(--tp-gold); }
.tp-list button {
  width: 100%; display: grid !important; grid-template-columns: minmax(0, 1fr) auto; column-gap: 10px; text-align: left;
  padding: 7px 8px !important; border-radius: 8px; place-items: initial !important;
}
.tp-list button:hover { background: rgba(255,255,255,.05); }
.tp-l-t { font-size: .93rem; line-height: 1.25; color: var(--tp-text); }
.tp-l-c { grid-column: 1; font-size: .8rem; color: var(--tp-muted); }
.tp-l-d { grid-column: 2; grid-row: 1 / 3; align-self: center; font: 500 .8rem/1 var(--tp-display); color: var(--tp-muted); }
.tp-list li.on button { background: rgba(180,40,30,.28); }
.tp-list li.on .tp-l-t { color: var(--tp-gold); font-weight: 600; }

/* ---------- 3. Minimized floating bar ---------- */
.tp-mini {
  position: fixed; z-index: 50;
  right: max(18px, env(safe-area-inset-right, 0px)); bottom: max(18px, env(safe-area-inset-bottom, 0px));
  width: min(360px, calc(100vw - 32px));
  display: flex; align-items: center; gap: 10px;
  padding: 10px 10px 10px 14px; border-radius: 20px;
  background: var(--tp-bg); border: 1px solid var(--tp-line);
  box-shadow: 12px 14px 26px rgba(0,0,0,.9), inset 0 1px 0 rgba(255,220,200,.07);
  backdrop-filter: blur(8px);
}
.tp-mini-main { flex: 1; min-width: 0; display: grid; gap: 6px; }
.tp-mini-info { min-width: 0; display: grid; gap: 2px; }
.tp-mini-title { font-size: .88rem; color: var(--tp-gold); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tp-mini .tp-live { font-size: .76rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tp-mini .tp-ctrls button { width: 36px; height: 36px; }
.tp-mini .tp-ctrls .tp-pp { width: 42px; height: 42px; }
.tp-mini .tp-expand { margin-left: auto; border: 1px solid var(--tp-line) !important; }
.tp-mini .tp-expand:hover { border-color: var(--tp-gold) !important; }
.tp-mini-bar { height: 3px; border-radius: 3px; background: rgba(255,255,255,.08); overflow: hidden; }
.tp-mini-bar i { display: block; height: 100%; width: 0; background: var(--tp-red); }
.tp-mini .tp-vol { height: 70px; }

/* Keep the floating player from covering the end of the page */
body:has(#tp[data-view="mini"]), body:has(.tp-launch.tp-float:not([hidden])) { padding-bottom: 120px; }

@media (max-width: 760px) {
  .tp-launch { padding: 10px 10px 8px 12px; }
  .tp-bigplay { width: 52px; height: 52px; }
  .tp-full {
    left: max(8px, env(safe-area-inset-left, 0px)); right: max(8px, env(safe-area-inset-right, 0px));
    bottom: max(8px, env(safe-area-inset-bottom, 0px)); width: auto; max-height: 84dvh; padding: 14px 14px 10px; border-radius: 22px;
  }
  .tp-now { grid-template-columns: 96px minmax(0, 1fr); gap: 12px; }
  .tp-art { width: 96px; height: 96px; }
  .tp-title { font-size: 1rem; }
  .tp-full .tp-ctrls { gap: 6px; }
  .tp-full .tp-vol-h .tp-vol { width: 70px; }
  .tp-mini { left: auto; right: max(8px, env(safe-area-inset-right, 0px)); bottom: max(8px, env(safe-area-inset-bottom, 0px)); width: min(360px, calc(100vw - 16px)); }
}
@media (prefers-reduced-motion: reduce) { #tp *, .tp-launch * { animation: none !important; transition: none !important; } }
/* a multi-movement work: heading row (title, composer, total time), then indented movements */
.tp-list li.tp-l-work { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 10px; padding: 8px 8px 4px; }
.tp-l-work .tp-l-t { font-weight: 600; color: var(--tp-gold); }
.tp-l-work .tp-l-d { color: var(--tp-gold); opacity: .85; }
/* the heading matches its group's bracket: red brackets get a red title, gold ones gold */
.tp-l-work:not(.g-alt) .tp-l-t, .tp-l-work:not(.g-alt) .tp-l-d { color: var(--link, #ff6a58); }
.tp-list li.tp-l-mv button { padding: 5px 8px 5px 22px !important; }
.tp-list li.tp-l-mv .tp-l-d { grid-row: 1; }
.tp-mv { display: block; margin-top: 2px; font-size: .95rem; font-weight: 400; color: var(--tp-text); }
/* small cover beside each work heading, and beside single pieces that come from a CD */
.tp-l-art { grid-column: 1; grid-row: 1 / 4; align-self: start; margin-top: 2px; width: 38px; height: 38px; object-fit: cover; border-radius: 4px; box-shadow: 0 2px 5px rgba(0,0,0,.6); }
.tp-list li.tp-l-work.has-art, .tp-list button.has-art { grid-template-columns: 38px minmax(0, 1fr) auto !important; column-gap: 10px; }
.has-art > .tp-l-t, .has-art > .tp-l-c { grid-column: 2; }
.has-art > .tp-l-d { grid-column: 3; }
/* work headings are clickable (play from the first movement) */
.tp-list li.tp-l-work { cursor: pointer; }
.tp-list li.tp-l-work:hover .tp-l-t, .tp-list li.tp-l-work:focus-visible .tp-l-t { text-decoration: underline; text-underline-offset: 3px; }
.tp-list li.tp-l-work:focus-visible { outline: 2px solid var(--tp-gold); outline-offset: -2px; }

/* private-preview tracks (future release date; visible only to the site owner): dashed teal outline, a pill and a note */
#tp .tp-list li.early { --c: 60, 200, 200; --row: #07201f; border: 0 dashed rgba(90, 220, 215, .85); border-left-width: 2px; border-right-width: 2px; }
#tp .tp-list li.early.g-first, #tp .tp-list li.early.solo { border-top-width: 2px; }
#tp .tp-list li.early.g-last, #tp .tp-list li.early.solo { border-bottom-width: 2px; }
#tp.tp-cards .tp-list li.early.solo .tp-l-t, #tp.tp-cards .tp-list li.early .tp-l-work .tp-l-t, .tp-l-work.early .tp-l-t { color: #7fe3dd; }
#tp.tp-cards .tp-list li.early .tp-l-t { color: #7fe3dd; }
.tp-early { display: inline-block; margin-left: 8px; padding: 1px 7px; border-radius: 999px; font-size: 11px; font-weight: 600; letter-spacing: .02em; color: #062b2a; background: #7fe3dd; white-space: nowrap; }
.tp-list li.tp-early-note { margin: 4px 0 8px; padding: 8px 10px; border: 1px dashed rgba(90, 220, 215, .7); border-radius: 8px; font-size: 12.5px; line-height: 1.4; color: #bfeeea; background: rgba(60, 200, 200, .08); list-style: none; }

/* a movement taken from a different performance than the rest of its album */
.tp-alt { display: inline-block; grid-column: 1; justify-self: start; margin: 3px 0 1px; padding: 0 7px; border-radius: 999px; font-size: 11px; font-weight: 600; color: var(--tp-gold); border: 1px solid currentColor; white-space: nowrap; vertical-align: 1px; }

/* total time with the recording date (month + year) under it, top right of each card */
.tp-l-dd { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; text-align: right; }
.tp-l-r { font-size: 11px; line-height: 1.2; opacity: .72; white-space: nowrap; letter-spacing: .02em; }

/* times: always the top-right of the box, top-aligned with the title; the recording date is right-aligned beneath it */
.tp-l-d { align-self: start; line-height: 1.25; }
.tp-l-dd { grid-column: -2 / -1; grid-row: 1 / span 3; align-self: start; display: flex; flex-direction: column; align-items: flex-end; text-align: right; gap: 2px; }
.tp-l-dd .tp-l-d { grid-column: auto; grid-row: auto; align-self: auto; }
.has-art > .tp-alt { grid-column: 2; }
.tp-l-mini { width: 22px; height: 22px; object-fit: cover; border-radius: 3px; margin-left: 8px; vertical-align: middle; box-shadow: 0 1px 3px rgba(0,0,0,.6); }

/* track numbers inside a CD card */
.tp-l-n { grid-column: 1; grid-row: 1 / 3; align-self: start; padding-top: 2px; font: 500 .8rem/1.25 var(--tp-display); color: var(--tp-muted); text-align: right; }
.tp-list li.on .tp-l-n { grid-column: 1; grid-row: 1 / 3; align-self: start; padding-top: 2px; font: 500 .8rem/1.25 var(--tp-display); color: var(--tp-muted); text-align: right; }
.tp-list li.tp-l-trk button { padding-left: 8px !important; }   /* numbers share one right-aligned column; movements indent their titles instead */
.tp-list li.tp-l-trk button { grid-template-columns: 1.7rem minmax(0, 1fr) auto !important; column-gap: 10px !important; }
.tp-l-trk .tp-l-t, .tp-l-trk .tp-l-c, .tp-l-trk .tp-alt { grid-column: 2; }
.tp-l-trk .tp-l-dd { grid-column: 3; }
.tp-list li.tp-l-trk.tp-l-mv .tp-l-t { padding-left: 12px; }

/* the CD card's heading (opened from a Listen button): cover and title 25% larger than a work heading */
.tp-list li.tp-l-album.has-art { grid-template-columns: 48px minmax(0, 1fr) auto !important; }
.tp-l-album .tp-l-art { width: 48px; height: 48px; }
.tp-l-album .tp-l-t { font-size: 1.16rem; }
