/* Interactive layer for the Christmas songs study: the rankings table, the
   tempo map, the shared Spotify player and a few layout fixes over the
   team's stylesheets (this file loads last). Cover art is shown whole, with
   no crop or overlay and 4px corners, per Spotify's design guidelines; play
   controls sit beside it, never on it. No pulsing dots: the only motion is
   the tick on the song that is actually playing, off under reduced motion. */

/* ---- Header and hero ---------------------------------------------------- */
header{background:rgba(248,251,249,.94);-webkit-backdrop-filter:blur(12px);backdrop-filter:blur(12px);margin-bottom:-82px}
section[id],main h2,main h3,#song-panel,.table-shell{scroll-margin-top:96px}
main p{text-wrap:pretty}
/* The photograph runs from the very top, behind the floating header. */
.editorial-hero{padding-top:176px;min-height:724px}
@media(min-width:1500px){.editorial-hero{min-height:784px}}
@media(max-width:900px) and (min-width:701px){.editorial-hero{min-height:684px;padding-top:176px}}
.editorial-hero .hero-intro{text-wrap:balance;line-height:1.6}
@media(max-width:700px){
  header{margin-bottom:-72px}
  /* Phones: the portrait photograph at the screen's width from just under
     the header, so only its two small top ornaments show (the dumbbell top
     left, the spruce and bauble top right) on plain mint; its foot falls
     below the hero. The CTA stays above the fold. */
  .editorial-hero{min-height:0;align-items:flex-start;padding:100px 22px 72px;background-size:100% auto;background-position:center top 76px;background-color:#e8f0eb}
  .editorial-hero .hero-intro{line-height:1.85}
  .editorial-hero .hero-content{gap:20px}
    }
@media(max-width:640px){.editorial-hero .hero-intro+.hero-intro{display:none}}

/* ---- Tabs, map and list share one 880px column --------------------------- */
/* The rankings section is one centred 880px column: heading, tabs, map, list. */
#rankings .wrap{max-width:880px}
#rankings .workout-tabs{margin:26px 0 0}
@media(max-width:700px){
  #rankings .workout-tabs{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}
  #rankings .workout-tabs button{min-height:44px;padding:0 6px;font-size:14px}
}

/* ---- Tempo map ------------------------------------------------------------ */
.tempo-map{position:relative;overflow:hidden;margin:18px 0 0;padding:18px 20px 14px;border:1px solid #d2dfd8;border-radius:16px;background:#fff}
.tempo-map figcaption{font-size:14px;color:#31524c}
.tempo-map figcaption strong{color:#175c53}
.tm-verb-touch{display:none}
@media(hover:none) and (pointer:coarse){.tm-verb-touch{display:inline}.tm-verb-mouse{display:none}}
.tm{position:relative;margin-top:16px}
.tm-frame{position:relative;display:flex;flex-direction:column-reverse}
.tm-frame.is-vertical{flex-direction:row}
.tm-plot{position:relative;flex:none;min-width:0}
.tm-frame.is-vertical .tm-plot{flex:1}
.tm-band{position:absolute;top:0;bottom:0}
.tm-frame.is-vertical .tm-band{left:0;right:0;top:auto;bottom:auto}
.tb-cool{background:rgba(76,142,131,.15)}
.tb-warm{background:rgba(76,142,131,.07)}
.tb-cardio{background:rgba(255,158,120,.12)}
.tb-hiit{background:rgba(255,158,120,.24)}
.tm-band:first-child{border-radius:10px 0 0 10px}
.tm-band:nth-child(4){border-radius:0 10px 10px 0}
.tm-frame.is-vertical .tm-band:first-child{border-radius:0 0 10px 10px}
.tm-frame.is-vertical .tm-band:nth-child(4){border-radius:10px 10px 0 0}
/* Band labels and the range chip: pills drawn above the outline, never hidden. */
.tm-band-label{position:absolute;z-index:4;padding:3px 8px;border-radius:999px;font-size:12px;font-weight:650;line-height:16px;color:#163732;white-space:nowrap}
.tl-cool{background:#e4eeeb}.tl-warm{background:#f1f6f5}.tl-cardio{background:#fff1ea}.tl-hiit{background:#ffe7dc}
.tm-grid{position:absolute;top:0;bottom:0;width:1px;background:rgba(22,55,50,.07)}
.tm-grid.is-zone{background:rgba(22,55,50,.26)}
.tm-frame.is-vertical .tm-grid{left:0;right:0;top:auto;width:auto;height:1px}
.tm-window{position:absolute;top:0;bottom:0;border-radius:8px;background:rgba(23,92,83,.06);box-shadow:inset 0 0 0 2px #175c53}
.tm-frame.is-vertical .tm-window{left:0;right:0;top:auto}
.tm-window-label{position:absolute;z-index:4;padding:3px 8px;border-radius:999px;background:#fff;box-shadow:inset 0 0 0 1.5px #175c53;font-size:12px;font-weight:700;line-height:16px;color:#175c53;white-space:nowrap}
.tm-dot{position:absolute;width:14px;height:14px;margin:-7px 0 0 -7px;border-radius:50%;background:#175c53;opacity:.35;outline:none;transition:scale .15s,opacity .15s}
.tm-dot.in-list{background:#ff9e78;opacity:1;box-shadow:0 0 0 1.5px #175c53}
.tm-dot.is-selected{opacity:1;z-index:2;box-shadow:0 0 0 2px #fff,0 0 0 4px #175c53}
/* Hover: a plain 2 px spruce ring; the play glyph stays on the selected dot. */
.tm-dot.is-hover{opacity:1;z-index:2;box-shadow:0 0 0 2px #fff,0 0 0 4px #175c53}
.tm-dot:focus-visible{opacity:1;z-index:3;box-shadow:0 0 0 2px #fff,0 0 0 4px #e6a100}
.tm-dot.is-selected{scale:1.2}
.tm-frame.is-vertical .tm-dot{width:22px;height:22px;margin:-11px 0 0 -11px}
.tm-frame.is-vertical .tm-dot.is-selected{scale:1.1}
.tm-frame.is-vertical .tm-dot::after{left:8.5px;top:6.5px;border-left-width:7px;border-top-width:4.5px;border-bottom-width:4.5px}
.tm-frame:not(.is-vertical) .tm-dot{width:20px;height:20px;margin:-10px 0 0 -10px}
.tm-frame:not(.is-vertical) .tm-dot.is-selected{scale:1.1}
.tm-frame:not(.is-vertical) .tm-dot::after{left:8px;top:5.5px;border-left-width:7px;border-top-width:4.5px;border-bottom-width:4.5px}
.tm-dot::after{content:'';position:absolute;left:5px;top:3.5px;border-left:5.5px solid #fff;border-top:3.5px solid transparent;border-bottom:3.5px solid transparent;opacity:0;transition:opacity .15s}
.tm-dot.in-list::after{border-left-color:#163732}
.tm-dot.is-selected::after{opacity:1}
.tm-dot.is-current{opacity:1}
.tm-dot.is-beating{animation:tempo-tick var(--beat) cubic-bezier(.16,1,.3,1) infinite;animation-delay:var(--beat-delay,0s)}
@keyframes tempo-tick{0%{transform:scale(1.35)}45%,100%{transform:scale(1)}}
.tm-ticks{position:relative;height:22px;flex:none}
.tm-tick{position:absolute;top:5px;transform:translateX(-50%);font-size:11.5px;color:#476862;font-variant-numeric:tabular-nums}
.tm-frame.is-vertical .tm-ticks{width:34px;height:auto}
.tm-frame.is-vertical .tm-tick{top:auto;right:7px;transform:translateY(50%)}
.tm-key{display:flex;flex-wrap:wrap;gap:4px 16px;margin-top:10px;font-size:12.5px;color:#31524c}
.tm-key span{display:inline-flex;align-items:center;gap:6px}
.key-dot{width:10px;height:10px;border-radius:50%;background:#175c53;opacity:.35}
.key-dot.is-in{background:#ff9e78;opacity:1;box-shadow:0 0 0 1.5px #175c53}
.key-win{width:16px;height:10px;border-radius:3px;background:rgba(23,92,83,.06);box-shadow:inset 0 0 0 1.5px #175c53}
/* Hover label (mouse) with its leader line, and the selected-song strip. */
.tm-tip{position:absolute;z-index:20;width:max-content;max-width:240px;padding:7px 11px;border:1px solid #d2dfd8;border-radius:10px;background:#fff;box-shadow:0 10px 24px -16px rgba(18,58,53,.45);pointer-events:none}
.tm-tip[hidden],.tm-leader[hidden]{display:none}
.tm-tip p{margin:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.tm-tip-title{font-size:13px;font-weight:700;color:#163732}
.tm-tip-sub{font-size:12px;color:#476862}
/* A 6 px caret under the label, pointing at its dot. */
.tm-tip::before,.tm-tip::after{content:'';position:absolute;left:calc(var(--caret-x, 50%) - 7px);border:7px solid transparent;border-bottom:0}
.tm-tip::before{bottom:-7px;border-top-color:#d2dfd8}
.tm-tip::after{bottom:-6px;border-top-color:#fff}
.tm-leader{position:absolute;z-index:19;width:1px;margin-left:-.5px;background:#9db9ae;pointer-events:none}
.tm-cover{flex:none;width:40px;height:40px;border-radius:4px;outline:1px solid rgb(0 0 0 / .08);outline-offset:-1px;background:#e3f2ef}
.tm-text{flex:1;min-width:0}
.tm-text p{margin:0}
.tm-head{display:flex;align-items:baseline;justify-content:space-between;gap:12px}
.tm-hint{flex:none;margin:0;padding:3px 10px;border-radius:999px;background:#fdf1ea;color:#8a3b1c;font-size:12px;font-weight:700;white-space:nowrap}
.tm-hint[hidden]{display:none}
.tm-title{font-size:14px;font-weight:700;line-height:1.3;color:#163732}
.tm-artist{font-size:13px;line-height:1.4;color:#476862}
.tm-meta{display:flex;align-items:center;flex-wrap:wrap;gap:4px 8px;margin-top:5px!important}

.tm-bpm{display:inline-block;padding:2px 8px;border-radius:999px;background:#e3f2ef;font-family:var(--display);font-size:13px;color:#175c53}
.tm-ranks{display:inline-flex;flex-wrap:wrap;font-size:12px;line-height:1.4;color:#476862}
.rk{white-space:nowrap}
.rk+.rk::before{content:'·';margin:0 6px}
.tm-play{flex:none;display:grid;place-items:center;width:44px;height:44px;padding:0;border:0;border-radius:50%;background:#175c53;color:#fff;cursor:pointer}
.tm-play svg{width:16px;height:16px;fill:currentColor}
.tm-play .icon-pause,.tm-play.is-playing .icon-play{display:none}
.tm-play.is-playing .icon-pause{display:block}
.tm-strip{display:flex;align-items:center;gap:8px;min-height:72px;margin:12px -4px 0;padding:12px 0 0;border-top:1px solid #d2dfd8}
.tm-strip[hidden]{display:none}
.tm-strip .tm-cover{width:44px;height:44px}
.tm-strip .tm-title{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;font-size:15px}
.tm-strip .tm-artist{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.tm-strip .tm-meta{margin-top:4px!important}
.tm-strip{gap:10px;padding:14px 0 2px}
.tm-strip .tm-text{flex:1}
.tm-prev,.tm-next{flex:none;display:grid;place-items:center;width:44px;height:44px;padding:0;border:0;border-radius:10px;background:transparent;color:#175c53;cursor:pointer}
.tm-prev svg,.tm-next svg{width:18px;height:18px}
.tm-prev:hover,.tm-next:hover{background:#e3f2ef}
@media(min-width:701px){
  .tm-strip .tm-cover{order:1}
  .tm-strip .tm-text{order:2}
  .tm-strip .tm-prev{order:3}
  .tm-strip .tm-play{order:4}
  .tm-strip .tm-next{order:5}
  .tm-strip .tm-cover{width:48px;height:48px}
  /* Art, legend, caption and plot share the card's 20 px inset. */
  .tm-strip{margin:12px 0 0}
}
@media(max-width:379px){.tm-strip .tm-cover{display:none}.tm-strip .tm-title{display:block;-webkit-line-clamp:unset}}
@media(max-width:700px){.tempo-map{padding:14px 12px 10px}.tm-key{font-size:12px}.tm-head{flex-direction:column;gap:8px}.tm-strip{gap:4px;margin:12px -8px 0}.tm-strip .tm-text{padding:0 4px}.tm-strip .tm-ranks{font-size:11.5px}}
.tm-bpm{white-space:nowrap}

/* ---- Rankings table ----------------------------------------------------- */
.rank-toolbar{flex-direction:row!important;align-items:flex-start!important;justify-content:space-between;gap:16px}
.copy-link{display:inline-flex;align-items:center;gap:7px;flex:none;width:auto!important;min-height:44px!important;padding:0 14px!important}
.copy-link svg{width:15px;height:15px}
.table-shell{overflow:hidden}
.song-table th{height:44px;padding:0 12px;text-align:left}
.song-table th.rank-col,.song-table td.rank-col{width:44px;padding:0 0 0 16px;text-align:left;font-variant-numeric:tabular-nums}
.song-table th.song-col{width:auto;padding-left:82px}
.song-table th.artist-col{width:28%}
.song-table td.artist-col{text-align:left;padding-left:12px}
.song-table th:last-child,.song-table td:last-child{width:140px}
.song-table th:last-child{text-align:right;padding-right:72px}
#sort-bpm{padding:0}
.song-table td{padding:14px 12px;overflow-wrap:normal;word-break:normal}
/* Even rows. */
#song-rows td{height:84px}
tr.is-current td{background:#fdf1ea}
.song-cell{display:flex;align-items:center;gap:14px;text-align:left}
.cover-link{flex:none;display:block;border-radius:4px}
.cover-link:focus-visible{outline:3px solid #2d7066;outline-offset:2px}
.cover{display:block;width:56px;height:56px;border-radius:4px;background:#e3f2ef;outline:1px solid rgb(0 0 0 / .08);outline-offset:-1px}
.song-text{min-width:0}
.song-name{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;font-size:15px;line-height:20px;text-wrap:balance}
.song-version{display:block;margin-top:2px;max-width:100%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;font-size:12px;line-height:1.4;color:#476862}
.bpm-cell{display:flex;align-items:center;justify-content:flex-end;gap:16px}
.bpm-value{display:block;min-width:44px;text-align:right;line-height:1;white-space:nowrap}
.play{position:relative;flex:none;display:grid;place-items:center;width:44px;height:44px;padding:0;border:0;border-radius:50%;background:#175c53;color:#f8fbf9;cursor:pointer;transition:background-color .18s}
.play:hover{background:#0f453e}
.play svg{width:16px;height:16px;fill:currentColor}
.play .icon-pause,.play.is-playing .icon-play{display:none}
.play.is-playing .icon-pause{display:block}
.play.is-current{background:#ff9e78;color:#163732}
/* Pressed, waiting for Spotify's player: a static, quieter button (no spinner). */
.play.is-loading{opacity:.6;cursor:progress}
/* The playing row's tick: a ring around its play button at the song's tempo. */
.play::after{content:'';position:absolute;inset:-5px;border-radius:50%;border:2px solid transparent;pointer-events:none}
.play.is-beating::after{border-color:rgba(255,158,120,.75);animation:ring-tick var(--beat) cubic-bezier(.16,1,.3,1) infinite;animation-delay:var(--beat-delay,0s)}
@keyframes ring-tick{0%{transform:scale(1.16);opacity:1}45%,100%{transform:scale(1);opacity:.5}}
@media (prefers-reduced-motion:reduce){.play.is-beating::after,.tm-dot.is-beating{animation:none}}
html:not(.js) .play{visibility:hidden}
.table-note{margin-top:12px!important;font-size:13px;color:#476862}
.table-note[hidden]{display:none}
.cover-credit{margin-top:4px;font-size:13px;color:#476862}
.cover-credit a{color:#175c53;text-underline-offset:3px}
.coach-note{margin-top:30px;max-width:74ch;font-size:15px;color:#31524c}
.coach-note a{color:#175c53;font-weight:650;text-underline-offset:3px}
@media(max-width:700px){
  .song-table th{height:40px;padding:0 6px;font-size:12px}
  .song-table th.rank-col,.song-table td.rank-col{width:34px;padding:0 0 0 12px}
  .song-table th.song-col{padding-left:64px}
  .song-table td{padding:10px 6px}
  /* 12 px inner insets left and right, so the playing button's ring clears the card edge. */
  .song-table th:last-child,.song-table td:last-child{width:110px;padding-right:12px}
  .song-table th:last-child{padding-right:64px}
  #song-rows td{height:88px}
  .song-cell{gap:10px}
  .cover{width:48px;height:48px}
  .song-name{font-size:16px;line-height:20px}
  .mobile-artist{display:block;margin-top:2px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;font-size:14px;line-height:18px}
  .bpm-cell{gap:8px}
  .bpm-value{min-width:36px}
  .song-table td:last-child{font-size:18px}
}
@media(max-width:379px){
  .song-table th.rank-col,.song-table td.rank-col{width:30px;padding-left:10px}
  .song-table th.song-col{padding-left:56px}
  .cover{width:40px;height:40px}
  .song-name{-webkit-line-clamp:3}
  .song-table td:last-child{width:104px;font-size:17px}
  #song-rows td{height:100px}
}

/* ---- Shared player ---------------------------------------------------- */
.player-dock{position:fixed;left:0;right:0;bottom:0;z-index:60;padding:10px 16px calc(10px + env(safe-area-inset-bottom));background:#fff;border-top:1px solid #d2dfd8;box-shadow:0 -12px 30px -22px rgba(18,58,53,.4);color:#163732}
.dock-inner{position:relative;max-width:860px;margin:0 auto;padding-right:52px;min-height:80px;display:flex;align-items:center}
.dock-frame{flex:1;min-width:0;height:80px}
.dock-frame iframe{display:block;border:0;border-radius:12px}
.dock-close{position:absolute;right:0;top:50%;transform:translateY(-50%);width:44px;height:44px;display:grid;place-items:center;border:0;border-radius:50%;background:transparent;color:#163732;cursor:pointer}
.dock-close:hover{background:#e3f2ef}
.dock-close svg{width:16px;height:16px}
.player-dock :focus-visible{outline:3px solid #175c53;outline-offset:2px}
.dock-error{margin:0;font-size:14px;color:#163732}
.dock-error a{color:#175c53;font-weight:650;text-underline-offset:3px}
@media(max-width:700px){.player-dock{padding:8px 8px calc(8px + env(safe-area-inset-bottom))}.dock-inner{padding-right:48px}}
/* Shown only when the browser held a start back: points at Spotify's own play
   button, which sits about 27px in from the embed's right edge. */
/* Safari's early player waits in place, unseen and untouchable (index.html: park). */
.player-dock.is-parked{visibility:hidden;pointer-events:none}
.dock-prompt{position:absolute;right:52px;bottom:calc(100% + 12px);z-index:1;margin:0;display:flex;align-items:center;gap:6px;padding:9px 15px;border-radius:999px;background:#163732;color:#f8fbf9;font-size:14px;font-weight:650;line-height:1.2;white-space:nowrap;box-shadow:0 10px 24px -12px rgba(18,58,53,.55);pointer-events:none}
.dock-prompt-btn{display:inline-grid;place-items:center;width:20px;height:20px;border-radius:50%;background:#fff}
.dock-prompt-btn svg{width:11px;height:11px;fill:#163732}
.dock-prompt::after{content:'';position:absolute;right:18px;top:calc(100% - 1px);border:9px solid transparent;border-top-color:#163732;border-bottom:0}
.dock-prompt[hidden]{display:none}
@media(max-width:700px){.dock-prompt{right:48px}}
/* Phones: the tempo map follows the list under its own heading. */
.tm-heading{margin:48px 0 0;font-size:23px;color:#175c53}
.tm-heading[hidden]{display:none}
.tm-heading+.tempo-map{margin-top:16px}
