/* The Listen ticket (approved: ../../../ticket-mockup/ticket/ticket.css, copied, not edited there), scoped to the
   Listen view: the red concert ticket with the song's full cover printed into it as a panel beside the artist and the
   song. Everything printed on it comes from the song itself (catalog.js). The service's own player is the shell's,
   laid over .tk-embed (see shell.css, .bgp-frame.is-ticket). */
.view-listen {
  --f-wood: 'Ultra', 'Rockwell Extra Bold', 'Rockwell', Georgia, serif;
  --f-display: 'Archivo', 'Helvetica Neue', Arial, sans-serif;
  --f-sans: 'Bricolage Grotesque', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --f-mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --stub: 104px;
  --notch: 13px;
  --art: 272px;
  --rz: -1.8deg;
  --surface: #e5dfd3; --surface-img: url(assets/linen.webp); --surface-size: 340px;
  --tk: #b2311e; --tk-2: #8f2413; --tk-ink: #fbf3ea; --tk-ink-2: rgba(251, 243, 234, .74);
  --shadow: rgba(60, 38, 20, .30); --shadow-2: rgba(60, 38, 20, .18);
  background: var(--surface) var(--surface-img) 0 0 / var(--surface-size) var(--surface-size);
  font: 16px/1.45 var(--f-sans); color: var(--tk-ink); -webkit-font-smoothing: antialiased;
}
html[data-theme="night"] .view-listen {
  --surface: #1e1d1c; --surface-img: url(assets/felt.webp); --surface-size: 380px;
  --tk: #a42a19; --tk-2: #771c10; --tk-ink: #f6eadb; --tk-ink-2: rgba(246, 234, 219, .72);
  --shadow: rgba(0, 0, 0, .62); --shadow-2: rgba(0, 0, 0, .4);
}
.view-listen *, .view-listen *::before, .view-listen *::after { box-sizing: border-box; }

.view-listen .tk-table {
  min-height: var(--bg-vh, 100svh); display: grid; place-items: center;
  padding: calc(var(--bg-nav-h, 64px) + 40px) max(24px, env(safe-area-inset-right)) max(48px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left));
}

/* the lift: perspective for the tilt, and the shadow that grows as the ticket comes off the table */
.view-listen .tk-lift {
  --lift: 0;
  width: min(920px, 100%); perspective: 1200px; touch-action: pan-y;
  filter: drop-shadow(calc(2px + var(--lift) * 6px) calc(3px + var(--lift) * 14px) calc(2px + var(--lift) * 10px) var(--shadow-2)) drop-shadow(calc(8px + var(--lift) * 10px) calc(14px + var(--lift) * 26px) calc(20px + var(--lift) * 18px) var(--shadow));
}
.view-listen .tk {
  --rx: 0deg; --ry: 0deg; --ty: 0px; --sc: 1; --mx: 50%; --my: 30%;
  position: relative; display: grid; grid-template-columns: var(--stub) minmax(0, 1fr);
  border-radius: 8px; color: var(--tk-ink); transform-style: preserve-3d;
  /* holding the ticket lifts it; it shouldn't select its text or pop the iPhone callout */
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  transform: translateY(var(--ty)) rotateX(var(--rx)) rotateY(var(--ry)) rotate(var(--rz)) scale(var(--sc));
  background: linear-gradient(176deg, color-mix(in srgb, var(--tk) 88%, #fff) 0, var(--tk) 22%, var(--tk) 78%, var(--tk-2) 100%);
  /* the two half-moon notches where the stub tears off */
  -webkit-mask: radial-gradient(circle at var(--stub) 0, transparent var(--notch), #000 calc(var(--notch) + .5px)) top / 100% 51% no-repeat, radial-gradient(circle at var(--stub) 100%, transparent var(--notch), #000 calc(var(--notch) + .5px)) bottom / 100% 51% no-repeat;
  mask: radial-gradient(circle at var(--stub) 0, transparent var(--notch), #000 calc(var(--notch) + .5px)) top / 100% 51% no-repeat, radial-gradient(circle at var(--stub) 100%, transparent var(--notch), #000 calc(var(--notch) + .5px)) bottom / 100% 51% no-repeat;
}
/* paper: fibres, grain, and a little wear along the edges (all under the cover art, never over it) */
.view-listen .tk::before { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: url(assets/grain-a.webp) 0 0 / 220px, url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='f'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9 .06' numOctaves='2' seed='7'/%3E%3CfeColorMatrix values='0 0 0 0 .3 0 0 0 0 .1 0 0 0 0 .05 0 0 0 .5 0'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23f)'/%3E%3C/svg%3E") 0 0 / 240px;
  opacity: .42; mix-blend-mode: multiply; }
.view-listen .tk::after { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .12), inset 0 0 22px rgba(60, 10, 0, .28); }
/* a soft sheen that follows the finger while the ticket is held */
.view-listen .tk-sheen { position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity .3s ease;
  background: radial-gradient(circle at var(--mx) var(--my), rgba(255, 240, 220, .38), rgba(255, 240, 220, 0) 46%); mix-blend-mode: soft-light; }
.view-listen .tk.held .tk-sheen { opacity: 1; }

/* ---------- stub (left on a desktop, along the bottom on an iPhone) ---------- */
.view-listen .tk-stub { grid-column: 1; grid-row: 1; position: relative; display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 26px 0 22px; min-width: 0; }
.view-listen .tk-h { margin: 0; writing-mode: vertical-rl; transform: rotate(180deg); font: 400 46px/1 var(--f-wood); letter-spacing: .04em; text-transform: uppercase; }
.view-listen .tk-h:focus { outline: none; }
.view-listen .tk-admit { writing-mode: vertical-rl; transform: rotate(180deg); font: 600 10.5px/1 var(--f-mono); letter-spacing: .26em; text-transform: uppercase; color: var(--tk-ink-2); }
.view-listen .tk-hole { width: 22px; height: 22px; flex: none; border-radius: 50%; background: var(--surface); box-shadow: inset 1px 2px 2px rgba(0, 0, 0, .45); transform: scale(0); transition: transform .28s cubic-bezier(.3, 1.6, .5, 1); }
.view-listen .tk.punched .tk-hole { transform: none; }
.view-listen .tk-code { margin-top: auto; width: 30px; height: 120px; color: var(--tk-ink); opacity: .9; }
/* the perforation: a row of punched dots down the tear line */
.view-listen .tk-perf { position: absolute; left: calc(var(--stub) - 2px); top: calc(var(--notch) + 6px); bottom: calc(var(--notch) + 6px); width: 4px; pointer-events: none;
  background: radial-gradient(circle at 2px 3px, rgba(40, 6, 0, .55) 1.5px, rgba(255, 230, 210, .18) 2.1px, transparent 2.4px) 0 0 / 4px 9px repeat-y; }

/* ---------- the printed side ---------- */
.view-listen .tk-main {
  grid-column: 2; grid-row: 1; position: relative; min-width: 0;
  display: grid; grid-template-columns: var(--art) minmax(0, 1fr); column-gap: 26px; row-gap: 12px; align-content: start;
  grid-template-areas: "k k" "art artist" "art song" "art facts" "act act" "note note" "alt alt";
  padding: 24px 28px 24px 30px;
}
.view-listen .tk-k { grid-area: k; margin: 0; font: 600 11px/1.3 var(--f-mono); letter-spacing: .2em; text-transform: uppercase; color: var(--tk-ink-2); }
/* the cover panel: printed in a deeper red block with a cream rule; the art itself is shown whole and untouched */
.view-listen .tk-art { grid-area: art; align-self: start; position: relative; z-index: 3; margin: 0; padding: 7px; background: var(--tk-2); border: 1.5px solid color-mix(in srgb, var(--tk-ink) 58%, transparent); border-radius: 3px; }
.view-listen .tk-art img { display: block; width: 100%; height: auto; aspect-ratio: 1; object-fit: contain; background: #000; }
.view-listen .tk-artist { grid-area: artist; align-self: end; margin: 0; font: 400 clamp(26px, 3.6vw, 40px)/1 var(--f-wood); letter-spacing: .02em; text-transform: uppercase; }
.view-listen .tk-song { grid-area: song; align-self: start; margin: 0; font: 900 84px/.86 var(--f-display); font-stretch: 62%; letter-spacing: -.004em; text-transform: uppercase; text-wrap: balance; overflow-wrap: normal; word-break: normal; }
.view-listen .tk-facts { grid-area: facts; align-self: end; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 16px; margin: 0; padding: 12px 0 0; border-top: 1.5px dashed color-mix(in srgb, var(--tk-ink) 42%, transparent); }
.view-listen .tk-facts div { min-width: 0; }
.view-listen .tk-facts dt { font: 600 10px/1.2 var(--f-mono); letter-spacing: .16em; text-transform: uppercase; color: var(--tk-ink-2); }
.view-listen .tk-facts dd { margin: 4px 0 0; font: 700 16px/1.2 var(--f-sans); font-stretch: 88%; }
.view-listen .tk-facts .e { display: inline-block; margin-left: 6px; padding: 1px 4px 0; border: 1.2px solid currentColor; border-radius: 3px; font: 700 10px/1.3 var(--f-mono); vertical-align: 2px; }
/* the cover and the details change together when the song changes */
.view-listen .tk-art img, .view-listen .tk-song, .view-listen .tk-facts dd, .view-listen .tk-kind { transition: opacity .16s ease; }
.view-listen .tk-main.swap .tk-art img, .view-listen .tk-main.swap .tk-song, .view-listen .tk-main.swap .tk-facts dd, .view-listen .tk-main.swap .tk-kind { opacity: 0; }

.view-listen .tk-act { grid-area: act; display: grid; gap: 10px; margin-top: 6px; padding-top: 14px; border-top: 1.5px dashed color-mix(in srgb, var(--tk-ink) 42%, transparent); }
/* the two ways to listen on the page: the chosen service is printed solid, the other in outline */
.view-listen .tk-svc { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.view-listen .tk-svcb { justify-content: flex-start; gap: 12px; min-height: 64px; padding: 9px 14px 9px 10px; text-align: left; }
.view-listen .tk-svcb .tk-ic { background: transparent; box-shadow: inset 0 0 0 1.6px var(--tk-ink); }
.view-listen .tk-svcb[aria-pressed="true"] { background: var(--tk-ink); color: var(--tk); border-color: var(--tk-ink); }
.view-listen .tk-svcb[aria-pressed="true"]:hover { background: var(--tk-ink); filter: brightness(1.04); }
.view-listen .tk-svcb[aria-pressed="true"] .tk-ic { background: var(--tk); box-shadow: none; }
.view-listen .tk-svcb.on .tk-ic::after { left: 15px; top: 14px; width: 14px; height: 16px; border: 0; background: linear-gradient(90deg, var(--tk-ink) 0 36%, transparent 36% 64%, var(--tk-ink) 64%); }
/* the service's own player sits straight on the ticket, the full width of the controls, with its own rounded card.
   This is its slot: the shell's one player is laid exactly over it (and is as tall as the service's player). */
.view-listen .tk-embed { position: relative; border-radius: 12px; background: rgba(40, 6, 0, .2); }
.view-listen .tk-alt { grid-area: alt; display: flex; flex-wrap: wrap; gap: 0 22px; margin: -4px 0 0; }
.view-listen .tk-alt a { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; color: var(--tk-ink); font: 600 13.5px/1.2 var(--f-sans); font-stretch: 88%; text-decoration: underline; text-decoration-style: dashed; text-decoration-color: color-mix(in srgb, var(--tk-ink) 55%, transparent); text-underline-offset: 4px; }
.view-listen .tk-note a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }
.view-listen .tk-btn { position: relative; display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 52px; padding: 10px 14px; border-radius: 8px; text-decoration: none; cursor: pointer;
  font: 700 15.5px/1.15 var(--f-sans); font-stretch: 88%; color: var(--tk-ink); background: transparent; border: 1.6px solid color-mix(in srgb, var(--tk-ink) 70%, transparent); transition: background-color .15s ease, transform .15s ease; -webkit-tap-highlight-color: transparent; }
.view-listen .tk-btn:hover { background: rgba(255, 240, 225, .1); }
.view-listen .tk-btn:active { transform: translateY(1px); }
.view-listen .tk-ic { position: relative; flex: none; width: 44px; height: 44px; border-radius: 50%; background: var(--tk); }
.view-listen .tk-ic::after { content: ''; position: absolute; left: 17px; top: 14px; border-style: solid; border-width: 8px 0 8px 13px; border-color: transparent transparent transparent var(--tk-ink); }
.view-listen .tk-pl { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.view-listen .tk-pl b { font: 800 17px/1.15 var(--f-sans); font-stretch: 90%; }
.view-listen .tk-pl small { font: 500 11px/1.2 var(--f-mono); letter-spacing: .05em; opacity: .75; }
.view-listen .tk-note { grid-area: note; margin: 0; font: 500 12px/1.5 var(--f-mono); color: var(--tk-ink-2); }
.view-listen .tk :focus-visible { outline: 2px solid var(--tk-ink); outline-offset: 3px; }

/* ---------- iPhone: a tall ticket, the stub tears off along the bottom ---------- */
@media (max-width: 560px) {
  .view-listen { --stub-h: 84px; --notch: 11px; --art: 132px; --rz: -1.2deg; }
  .view-listen .tk-table { place-items: start center; padding-top: calc(var(--bg-nav-h, 56px) + 20px); padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
  .view-listen .tk { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto var(--stub-h);
    -webkit-mask: radial-gradient(circle at 0 calc(100% - var(--stub-h)), transparent var(--notch), #000 calc(var(--notch) + .5px)) left / 51% 100% no-repeat, radial-gradient(circle at 100% calc(100% - var(--stub-h)), transparent var(--notch), #000 calc(var(--notch) + .5px)) right / 51% 100% no-repeat;
    mask: radial-gradient(circle at 0 calc(100% - var(--stub-h)), transparent var(--notch), #000 calc(var(--notch) + .5px)) left / 51% 100% no-repeat, radial-gradient(circle at 100% calc(100% - var(--stub-h)), transparent var(--notch), #000 calc(var(--notch) + .5px)) right / 51% 100% no-repeat; }
  .view-listen .tk-main { grid-column: 1; grid-row: 1; column-gap: 14px; row-gap: 10px; padding: 18px 16px 16px;
    grid-template-areas: "k k" "art artist" "art facts" "song song" "act act" "note note" "alt alt"; }
  .view-listen .tk-svc { gap: 8px; }
  .view-listen .tk-svcb { min-height: 58px; padding: 7px 10px 7px 7px; gap: 9px; }
  .view-listen .tk-svcb .tk-ic { width: 38px; height: 38px; }
  .view-listen .tk-svcb .tk-ic::after { left: 14px; top: 11px; }
  .view-listen .tk-svcb.on .tk-ic::after { left: 12px; top: 11px; }
  .view-listen .tk-svcb b { font-size: 15px; }
  .view-listen .tk-svcb small { font-size: 10px; }
  .view-listen .tk-alt { gap: 0 16px; }
  .view-listen .tk-alt a { font-size: 13px; }
  .view-listen .tk-k { font-size: 10px; letter-spacing: .16em; }
  .view-listen .tk-art { padding: 5px; }
  .view-listen .tk-artist { font-size: 23px; line-height: .98; align-self: start; }
  .view-listen .tk-facts { align-self: end; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 10px; padding-top: 10px; }
  .view-listen .tk-facts dt { font-size: 9px; letter-spacing: .12em; }
  .view-listen .tk-facts dd { font-size: 13.5px; margin-top: 2px; }
  .view-listen .tk-song { margin-top: 2px; }
  .view-listen .tk-act { padding-top: 12px; }
  .view-listen .tk-btn { min-height: 48px; font-size: 14.5px; padding: 8px 10px; }
  .view-listen .tk-pl b { font-size: 16px; }
  .view-listen .tk-note { font-size: 11.5px; }
  .view-listen .tk-stub { grid-column: 1; grid-row: 2; flex-direction: row; justify-content: space-between; align-items: center; gap: 12px; padding: 0 18px; }
  .view-listen .tk-h { writing-mode: horizontal-tb; transform: none; font-size: 32px; }
  .view-listen .tk-admit { writing-mode: horizontal-tb; transform: none; font-size: 9.5px; letter-spacing: .22em; margin-right: auto; }
  .view-listen .tk-hole { width: 18px; height: 18px; }
  .view-listen .tk-code { margin: 0; width: 96px; height: 34px; }
  .view-listen .tk-perf { left: calc(var(--notch) + 6px); right: calc(var(--notch) + 6px); top: calc(100% - var(--stub-h) - 2px); bottom: auto; width: auto; height: 4px;
    background: radial-gradient(circle at 3px 2px, rgba(40, 6, 0, .55) 1.5px, rgba(255, 230, 210, .18) 2.1px, transparent 2.4px) 0 0 / 9px 4px repeat-x; }
}

@media (prefers-reduced-motion: reduce) {
  .view-listen .tk-hole, .view-listen .tk-art img, .view-listen .tk-song, .view-listen .tk-facts dd, .view-listen .tk-kind, .view-listen .tk-sheen { transition: none; }
}
