/* Player + lyrics — shared by the home page and the lyrics pages */
/* colours come from theme.css */

.ico { width: 11px; height: 12px; fill: currentColor; flex: none; }

/* ===== One song ===== */
.song { margin: 0 auto 110px; }
.song h2 {
  font-weight: 400; font-size: 30px; line-height: 1.1;
  text-align: center; margin-bottom: 44px; padding: 0 16px;
}
.song .play {
  display: flex; align-items: center; gap: 9px;
  margin: -28px auto 40px; padding: 6px 4px;
  background: none; border: 0; color: var(--muted); cursor: pointer;
  font-family: var(--sans); font-weight: 600; font-size: 13px; letter-spacing: .08em; text-transform: uppercase;
  transition: color .15s;
}
.song .play:hover, .song .play:active, .song.playing .play { color: var(--accent); }

/* ===== Lyric lines, mirrored: a flipped ghost copy on the left meets the line at the centre,
         with the line number between them like a bar number on sheet music; dim until lit ===== */
.lines { max-width: 1100px; margin: 0 auto; padding: 0 clamp(10px, 3vw, 32px); }
.line {
  display: grid; grid-template-columns: 1fr 40px 1fr; align-items: baseline;
  font-family: var(--sans); font-weight: 600; text-transform: uppercase;
  font-size: clamp(10px, 2.9vw, 15px); line-height: 1.5; letter-spacing: .02em;
  padding: 3px 0;
  color: var(--ghost);
  transition: color .35s ease;
}
.line .ghost { transform: scaleX(-1); color: var(--ghost); }              /* flipped, so it starts at the centre and reads outward */
.line .n { justify-self: center; font-size: 10px; letter-spacing: .06em; color: var(--ghost); font-variant-numeric: tabular-nums; transition: color .35s ease; }
.line.lit, .line.now { color: var(--ink); }
.line.lit .n, .line.now .n { color: var(--accent); }
.line.gap { height: 1.2em; padding: 0; }
.song[data-abs] .line[data-t] { cursor: pointer; }
.song[data-abs] .line[data-t]:hover { color: var(--line-dim); }
.song[data-abs] .line[data-t]:hover .n { color: var(--accent); }
@media (prefers-reduced-motion: reduce) { .line, .line .n { transition: none; } }

/* ===== Now-playing bar ===== */
.bar {
  position: fixed; inset: auto 0 0 0; z-index: 40;
  background: var(--bg); border-top: 1px solid var(--rule);
  padding: 16px 16px max(12px, env(safe-area-inset-bottom));      /* room on top for the hide handle */
  transform: translateY(110%); transition: transform .3s ease;
}
.bar.on { transform: none; }
.bar .row { max-width: 440px; margin: 0 auto; display: grid; grid-template-columns: 26px 36px 26px 1fr auto; align-items: center; gap: 8px; }
.bar .pp {
  width: 36px; height: 36px; border: 1.5px solid var(--ink); border-radius: 50%;
  background: none; color: var(--ink); display: grid; place-items: center; cursor: pointer;
}
.bar .pp:hover { color: var(--accent); border-color: var(--accent); }
.bar .pp.pulse { color: #000; background: var(--accent); border-color: var(--accent); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px rgba(254, 85, 58, .18); } }
@media (prefers-reduced-motion: reduce) { .bar .pp.pulse { animation: none; } }
.bar .pp .ico { width: 12px; height: 13px; }
.bar .t { font-family: var(--serif); font-size: 18px; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: none; border: 0; color: inherit; text-align: left; cursor: pointer; padding: 0; }
.bar .t:hover { color: var(--accent); }
.bar .time { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.bar a.cap { display: inline-flex; align-items: center; gap: 10px; }
.bar a.cap:hover { color: var(--accent); }
.bar input[type=range] {
  -webkit-appearance: none; appearance: none; display: block;
  width: 100%; max-width: 440px; margin: 10px auto 0; height: 14px; background: transparent; cursor: pointer;
  --p: 0%;
}
.bar input[type=range]::-webkit-slider-runnable-track { height: 2px; background: linear-gradient(var(--accent), var(--accent)) 0 / var(--p) 100% no-repeat, var(--track); }
.bar input[type=range]::-moz-range-track { height: 2px; background: var(--track); }
.bar input[type=range]::-moz-range-progress { height: 2px; background: var(--accent); }
.bar input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 10px; height: 10px; border-radius: 50%; background: var(--ink); margin-top: -4px; }
.bar input[type=range]::-moz-range-thumb { width: 10px; height: 10px; border: 0; border-radius: 50%; background: var(--ink); }
body.has-bar { padding-bottom: 92px; }

/* "Back to current line" while a synced song plays and you've scrolled away */
.follow {
  position: fixed; left: 50%; bottom: 112px; z-index: 40; transform: translateX(-50%);
  background: var(--bg); color: var(--ink); border: 1.5px solid var(--ink); padding: 6px 12px; cursor: pointer;
  font-family: var(--sans); font-weight: 600; font-size: 12px; letter-spacing: .08em; text-transform: uppercase;
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.follow.on { opacity: 1; pointer-events: auto; }
.follow:hover { color: var(--accent); border-color: var(--accent); }

/* ===== Lyrics panel on the home page (slides up over the page; music keeps playing) ===== */
.sheet {
  position: fixed; inset: 0; z-index: 30;
  background: var(--bg); overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  transform: translateY(100%); visibility: hidden;
  transition: transform .38s cubic-bezier(.2, .8, .2, 1), visibility 0s linear .38s;
}
.sheet.on { transform: none; visibility: visible; transition: transform .38s cubic-bezier(.2, .8, .2, 1); }
.sheet .head {
  position: sticky; top: 0; z-index: 2; text-align: center;
  padding: max(16px, env(safe-area-inset-top)) 56px 30px;
  background: linear-gradient(var(--bg) 0, var(--bg) 70%, var(--fade));
}
.sheet .head .cap { display: block; color: var(--ink); }
.sheet .head h1 { font-weight: 400; font-size: clamp(30px, 9vw, 40px); line-height: 1.05; margin: 10px 0 12px; }
.sheet .head .out { display: inline-flex; align-items: center; gap: 10px; border: 1.5px solid var(--ink); padding: 6px 10px 6px 12px; }
.sheet .head .out:hover { color: var(--accent); border-color: var(--accent); }
.sheet .close {
  position: absolute; top: max(12px, env(safe-area-inset-top)); right: 12px;
  width: 40px; height: 40px; display: grid; place-items: center;
  background: none; border: 0; color: var(--ink); cursor: pointer;
}
.sheet .close:hover { color: var(--accent); }
.sheet .close svg { width: 18px; height: 18px; stroke: currentColor; stroke-width: 1.6; fill: none; stroke-linecap: round; }
.sheet .body { padding: 50px 0 140px; }
body.sheet-open { overflow: hidden; }
@media (prefers-reduced-motion: reduce) { .sheet, .sheet.on { transition: none; } }

/* ===== Hide / show the player ===== */
/* The handle on top of the bar: tap (or swipe the bar down) to tuck the player away */
.bar-grab {
  position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 72px; height: 16px; padding: 0; display: grid; place-items: center;
  background: none; border: 0; cursor: pointer;
}
.bar-grab::before { content: ""; width: 36px; height: 4px; border-radius: 2px; background: var(--ghost); transition: background .15s; }
.bar-grab:hover::before, .bar-grab:focus-visible::before { background: var(--accent); }
.bar-grab:focus-visible { outline: none; }
.bar.on.min { transform: translateY(110%); }

/* What's left when it's tucked away: a little pill with play/pause and an arrow to bring the player back */
.bar-tab {
  position: fixed; z-index: 40; left: 50%; bottom: max(14px, env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: 2px; padding: 3px;
  background: var(--bg); border: 1.5px solid var(--ink); border-radius: 999px;
  transform: translate(-50%, 160%); opacity: 0; pointer-events: none;
  transition: transform .3s ease, opacity .3s ease;
}
.bar-tab.on { transform: translate(-50%, 0); opacity: 1; pointer-events: auto; }
.bar-tab button {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: none; border: 0; color: var(--ink); cursor: pointer; padding: 0;
}
.bar-tab button:hover, .bar-tab button:focus-visible { color: var(--accent); }
.bar-tab button:focus-visible { outline: 1.5px solid var(--accent); outline-offset: 1px; }
.bar-tab .ico { width: 11px; height: 12px; }
.bar-tab .tu svg { width: 12px; height: 8px; stroke: currentColor; stroke-width: 1.6; fill: none; stroke-linecap: round; stroke-linejoin: round; }
body.has-bar.bar-min { padding-bottom: 64px; }
body.bar-min .follow { bottom: 70px; }
@media (prefers-reduced-motion: reduce) { .bar-tab, .bar-grab::before { transition: none; } }

/* Subtler tucked-away state: no outline, small, in the bottom-right corner — and on pages with the
   world clock frame, everything sits just inside the frame so the times are never covered */
.bar-tab {
  left: auto; right: max(10px, env(safe-area-inset-right)); bottom: max(10px, env(safe-area-inset-bottom));
  transform: translateY(160%);
  border: 0; padding: 0; gap: 0;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.bar-tab.on { transform: none; }
.bar-tab button { width: 30px; height: 30px; color: var(--muted); }
.bar-tab button:hover, .bar-tab button:focus-visible { color: var(--accent); }
body.has-frame .bar-tab { right: calc(var(--wf) + 8px); bottom: calc(var(--wf) + 8px); }
body.has-frame .bar { left: var(--wf); right: var(--wf); bottom: var(--wf); padding-bottom: 12px; }
body.has-frame.has-bar { padding-bottom: calc(92px + var(--wf)); }
body.has-frame.has-bar.bar-min { padding-bottom: calc(48px + var(--wf)); }
body.bar-min .follow { bottom: calc(48px + var(--wf, 0px)); }
/* Tucked away = fully gone (not peeking into the clock strip), and out of reach of taps and screen readers */
.bar.on.min { transform: translateY(calc(100% + 40px)); visibility: hidden; transition: transform .3s ease, visibility 0s linear .3s; }
/* Before any music plays the bar is hidden: push it fully off screen (past the clock strip on the home page)
   and take it out of view entirely, so it can never cover the frame's moving times */
.bar:not(.on) { transform: translateY(calc(100% + 40px)); visibility: hidden; transition: transform .3s ease, visibility 0s linear .3s; }

/* Previous / Next, either side of play — same quiet style as the other bar buttons */
.bar .prev, .bar .next {
  width: 26px; height: 36px; display: grid; place-items: center; padding: 0;
  background: none; border: 0; color: var(--ink); cursor: pointer;
}
.bar .prev:hover, .bar .next:hover, .bar .prev:focus-visible, .bar .next:focus-visible { color: var(--accent); }
.bar .prev .ico, .bar .next .ico { width: 11px; height: 11px; }
.bar .t { margin-left: 4px; }
