/* The demos player (js/player.js): the category filters, the list of pieces, each with its waveform, the sounds it
   plays lit while heard, its tags and its heart, and the bar at the foot. Shared by the pages that play demos (Sacred's,
   AMBER's); each page keeps its own heading, its end and its colours' meaning */
:root { --panel: #191c21; --wave: #3a3f48; --gold-dim: #8a6f35; --blue: #8fb3e0; --pink: #e3a3c0; --green: #7fc59a; --rose: #f07a95; --violet: #b9a6e8; }

.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 36px 0 0; }
.filters button { font: 500 14px var(--font); color: var(--soft); background: none; border: 1px solid var(--line); border-radius: 999px;
  padding: 6px 15px; cursor: pointer; transition: border-color .2s; }
.filters button:hover { border-color: var(--muted); }
.filters button[aria-pressed="true"] { color: var(--graphite); background: var(--light); border-color: var(--light); }
.filters small { margin-left: 6px; font-size: 12px; opacity: .65; }

.list { list-style: none; margin: 20px 0 0; padding: 0; border-top: 1px solid var(--line); }
.track { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 0 16px; padding: 20px 0; border-bottom: 1px solid var(--line); scroll-margin: 24px 0 120px; }
.track[hidden] { display: none; }
.play { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel); color: var(--light);
  display: grid; place-items: center; cursor: pointer; transition: border-color .2s, background .2s; }
.play:hover { border-color: var(--gold); }
.play svg, .ctl svg { width: 16px; height: 16px; fill: currentColor; }
.track.on .play { background: var(--gold); border-color: var(--gold); color: #1a1408; }
.side { display: flex; flex-direction: column; align-items: center; gap: 10px; }   /* the play, and the heart under it */
.head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; min-height: 44px; }
.by { margin-left: auto; font-size: 13px; color: var(--muted); white-space: nowrap; }
.by b { font-weight: 600; color: var(--soft); }
.track h3 { margin: 0; font-size: 20px; font-weight: 600; line-height: 1.2; transition: color .2s; }
.track.on h3 { color: var(--gold); }
.time { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
/* love: a heart per piece, filled once this visitor loves it (no count shown) */
.love { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; padding: 0; border: 1px solid var(--line); border-radius: 50%;
  background: none; color: var(--muted); cursor: pointer; transition: color .2s, border-color .2s; }
.side .love { background: var(--panel); }
.side .love svg { width: 15px; height: 15px; }
.love svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linejoin: round; transition: fill .2s; }
.love:hover { color: var(--rose); border-color: color-mix(in srgb, var(--rose) 45%, transparent); }
.love[aria-pressed="true"] { color: var(--rose); border-color: color-mix(in srgb, var(--rose) 45%, transparent); }
.love[aria-pressed="true"] svg { fill: currentColor; animation: beat .45s cubic-bezier(.3,1.6,.5,1); }
@keyframes beat { 0% { transform: scale(.6); } 60% { transform: scale(1.25); } 100% { transform: scale(1); } }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.tag { padding: 0 8px; border: 1px solid var(--line); border-radius: 4px; font-size: 12px; line-height: 20px; color: var(--soft); white-space: nowrap; }
.tag.type { color: var(--blue); border-color: color-mix(in srgb, var(--blue) 45%, transparent); }
.tag.mood { color: var(--pink); border-color: color-mix(in srgb, var(--pink) 45%, transparent); }
.tag.style { color: var(--violet); border-color: color-mix(in srgb, var(--violet) 45%, transparent); }
.tag.bpm { color: var(--green); border-color: color-mix(in srgb, var(--green) 45%, transparent); }
.player { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; margin-top: 4px; }
.wave { display: block; width: 100%; height: 40px; cursor: pointer; }
/* the sounds it plays: one line that wraps, an instrument's name, then its presets, all in the instrument's colour,
   each lit up while it's heard */
.used { display: flex; flex-wrap: wrap; gap: 2px 16px; margin: 8px 0 0; font-size: 13px; line-height: 1.7; color: var(--muted); }
.used .i { transition: opacity .3s; }
.track.on .used .i:not(.on) { opacity: .35; }   /* the piece playing: the instruments not heard now step back */
.used .i b { font-weight: 600; color: color-mix(in srgb, var(--a) 70%, var(--soft)); transition: color .25s; }
.used .i.on b { color: var(--a); }
.used .add { --a: #e8bd5c; }   /* (the drums, not one of the six: in gold, never white) */
.p { padding: 0; border: 0; background: none; font: inherit; color: color-mix(in srgb, var(--a) 45%, var(--soft)); cursor: pointer; transition: color .25s, text-shadow .25s; }   /* (always in its instrument's colour, quieter till it's heard) */
.p:hover { color: var(--a); }
.p.on { color: var(--a); text-shadow: 0 0 12px color-mix(in srgb, var(--a) 55%, transparent); }

/* the bar at the foot: what's playing, and the sounds heard now in their colours */
.bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px));
  background: rgba(25,28,33,.94); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); border-top: 1px solid var(--line); }
.bar .prog { position: absolute; left: 0; right: 0; top: -1px; height: 2px; }
.bar .prog i { display: block; height: 100%; background: var(--gold); transform: scaleX(0); transform-origin: 0 50%; }
.bar .in { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto auto; gap: 14px; align-items: center; max-width: 728px; margin: 0 auto; }
.ctl { display: flex; align-items: center; gap: 6px; }
.ctl button, #b-open { display: grid; place-items: center; width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 50%; background: none; color: var(--light); cursor: pointer; }
.ctl button:hover, #b-open:hover { border-color: var(--muted); }
#b-open svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ctl #b-play { width: 44px; height: 44px; background: var(--gold); border-color: var(--gold); color: #1a1408; }
.np { min-width: 0; line-height: 1.35; }
.np b, .np span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.np b { font-size: 15px; }
.np span { font-size: 13px; color: var(--muted); }
.np em { font-style: normal; color: var(--a); }
/* the volume: a speaker that mutes, and its slider, gold up to the level */
.vol { display: flex; align-items: center; gap: 2px; }
#b-vol { display: grid; place-items: center; width: 32px; height: 38px; padding: 0; border: 0; background: none; color: var(--soft); cursor: pointer; transition: color .2s; }
#b-vol:hover { color: var(--light); }
#b-vol svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
#b-vol .body { fill: currentColor; stroke: none; }
#vol { --v: 100%; -webkit-appearance: none; appearance: none; width: 84px; height: 24px; margin: 0; background: none; cursor: pointer; }
#vol[hidden] { display: none; }
#vol::-webkit-slider-runnable-track { height: 3px; border-radius: 2px; background: linear-gradient(90deg, var(--gold) var(--v), var(--wave) var(--v)); }
#vol::-moz-range-track { height: 3px; border-radius: 2px; background: linear-gradient(90deg, var(--gold) var(--v), var(--wave) var(--v)); }
#vol::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 12px; margin-top: -4.5px; border: 0; border-radius: 50%; background: var(--light); transition: transform .15s; }
#vol::-moz-range-thumb { width: 12px; height: 12px; border: 0; border-radius: 50%; background: var(--light); transition: transform .15s; }
#vol:hover::-webkit-slider-thumb { transform: scale(1.2); }
#vol:hover::-moz-range-thumb { transform: scale(1.2); }
body.listening .page { padding-bottom: 150px; }
/* a browser that waits for a tap before it plays: the piece is loaded, its button calls */
.track.ready .play, .bar.ready #b-play { animation: call 1.6s ease-out infinite; }
@keyframes call { from { box-shadow: 0 0 0 0 rgba(232,189,92,.55); } to { box-shadow: 0 0 0 14px rgba(232,189,92,0); } }
.play:focus-visible, .love:focus-visible, .p:focus-visible, .wave:focus-visible, .filters button:focus-visible, .ctl button:focus-visible, #b-vol:focus-visible, #vol:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
/* opened from the Sacred page's Hear it, in its window: only the pieces, in that page's type, on its ground (the
   window's, through this one), the window's close at the top right, a thin scrollbar; docked there once it closes with
   a piece loaded, only the bar shows, with a button to open the list again */
.framed { --font: "Archivo", "Segoe UI", system-ui, sans-serif; background: none; scrollbar-width: thin; scrollbar-color: #2a2e35 transparent; }
.framed body { background: none; }
.framed .page { padding-top: 26px; }
.framed :is(.page > header, .eyebrow, h1, .lede, footer) { display: none; }
.framed .filters { margin-top: 0; padding-right: 56px; }
.framed .end { margin-top: 56px; }
.framed:not(.mini) .bar { background: rgb(14 15 19 / .97); -webkit-backdrop-filter: none; backdrop-filter: none; }   /* (no blur to work out as the list scrolls under it) */
#b-open { display: none; }
html.mini { overflow: hidden; scrollbar-width: none; }
html.mini::-webkit-scrollbar { display: none; }
/* docked, the frame holds the bar alone, in its flow: no list under it to scroll, and no fixed bar in a frame, which Safari
   on iOS placed and hit wrong (the taps went through to the page) */
html.mini .page { display: none; }
.mini .bar { position: relative; }
.mini #b-open { display: grid; }
.mini .bar .in { grid-template-columns: auto minmax(0, 1fr) auto auto auto auto; }
.mini .bar { background: rgb(25 28 33); -webkit-backdrop-filter: none; backdrop-filter: none; }   /* (docked, nothing to see through it: no blur to work out) */
@media (max-width: 560px) {
  .track { grid-template-columns: 40px minmax(0, 1fr); gap: 0 12px; }
  .play { width: 40px; height: 40px; }
  .side .love { width: 34px; height: 34px; }
  .head { min-height: 40px; }
  .track h3 { font-size: 18px; }
  .bar .in { grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; }
  .mini .bar .in { grid-template-columns: auto minmax(0, 1fr) auto auto; }
  .ctl button { width: 34px; height: 34px; }
  .bar :is(.time, .vol) { display: none; }   /* (a phone has its own volume buttons) */
}
