/* Background-music pill: a transparent island-shaped pill; one tap pauses / resumes. */
@property --mp-angle {
  syntax: '<angle>';
  inherits: false;
  initial-value: 0deg;
}

.music-pill {
  --mp-gold: 184, 137, 58;
  --mp-light: 205, 150, 45;  /* rich gold: reads on the cream page, unlike a pale highlight */
  position: fixed;
  z-index: 70;  /* above gate (50) and petals (60) */
  left: 50%;
  bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  display: flex;
  align-items: center;
  justify-content: center;
  width: 62px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: rgb(var(--mp-gold));
  cursor: pointer;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
  opacity: 0;
  transform: translate(-50%, 6px);
  transition: opacity 1.2s ease, transform 1.2s ease;
}
.music-pill[hidden] { display: none; }
.music-pill.is-shown { opacity: .6; transform: translate(-50%, 0); }
.music-pill:active { transform: translate(-50%, 0) scale(.95); transition-duration: .15s; }
.music-pill:focus-visible { outline: 1px solid rgba(var(--mp-gold), .6); outline-offset: 3px; }

/* hairline border + a soft gold light that glides round it, then rests */
.music-pill::before,
.music-pill::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  pointer-events: none;
}
.music-pill::before { background: rgba(var(--mp-gold), .3); }
.music-pill::after {
  background: conic-gradient(from var(--mp-angle),
    transparent 0deg,
    rgba(var(--mp-light), 0) 250deg,
    rgba(var(--mp-light), .4) 290deg,
    rgba(var(--mp-light), 1) 350deg,
    transparent 360deg);
  padding: 1.25px;
  filter: drop-shadow(0 0 2px rgba(222, 170, 70, .7));
  animation: mp-orbit 5s cubic-bezier(.45, 0, .55, 1) infinite;
}
@keyframes mp-orbit {
  0%        { --mp-angle: 0deg;   opacity: 0; }
  8%        { opacity: 1; }
  62%       { opacity: 1; }
  70%, 100% { --mp-angle: 360deg; opacity: 0; }  /* ~1.5 s rest between rounds */
}
.music-pill.is-paused::after { animation: none; opacity: 0; }

/* the wave: five thin bars that breathe while playing, flatten when muted */
.mp-wave { display: flex; align-items: center; gap: 2.5px; height: 11px; }
.mp-wave i {
  display: block;
  width: 1.5px;
  height: 100%;
  border-radius: 1px;
  background: currentColor;
  transform-origin: center;
  animation: mp-bar 1.1s ease-in-out infinite;
}
.mp-wave i:nth-child(1) { animation-delay: -.2s;  animation-duration: 1.2s; }
.mp-wave i:nth-child(2) { animation-delay: -.6s;  animation-duration: .9s; }
.mp-wave i:nth-child(3) { animation-delay: -.1s;  animation-duration: 1.05s; }
.mp-wave i:nth-child(4) { animation-delay: -.45s; animation-duration: .95s; }
.mp-wave i:nth-child(5) { animation-delay: -.8s;  animation-duration: 1.25s; }
@keyframes mp-bar {
  0%, 100% { transform: scaleY(.25); }
  50%      { transform: scaleY(1); }
}
/* paused: the wave folds away and a small play triangle takes its place */
.mp-wave, .mp-play { transition: opacity .35s ease, transform .35s ease; }
.mp-play {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 9px;
  height: 10px;
  fill: currentColor;
  opacity: 0;
  transform: translate(-40%, -50%) scale(.6);
}
.is-paused .mp-wave { opacity: 0; transform: scale(.6); }
.is-paused .mp-wave i { animation-play-state: paused; }
.is-paused .mp-play { opacity: 1; transform: translate(-40%, -50%) scale(1); }

/* ───────── Scroll cue (scroll-cue.js): "Scroll" with two chevrons lighting up in turn ───────── */
.scroll-cue {
  position: fixed;
  z-index: 70;
  left: 50%;
  bottom: calc(14px + 24px + 10px + env(safe-area-inset-bottom, 0px));  /* just above the music pill */
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4px 10px;
  border: 0;
  background: none;
  color: #84591C;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: opacity .8s ease, visibility 0s linear .8s;
  -webkit-tap-highlight-color: transparent;
}
.scroll-cue.is-on { opacity: 1; visibility: visible; transition: opacity .8s ease; }
.scroll-cue::before {  /* soft cream glow keeps it legible over anything behind */
  content: "";
  position: absolute;
  inset: -10px -16px;
  z-index: -1;
  background: radial-gradient(closest-side, rgba(253, 247, 234, .95), rgba(253, 247, 234, 0));
}
.scroll-cue small {
  font-family: 'Cinzel', serif;
  font-size: 8.5px;
  letter-spacing: .3em;
  padding-left: .3em;  /* balances the trailing letter-spacing */
  text-transform: uppercase;
  margin-bottom: 2px;
}
.scroll-cue svg {
  width: 16px;
  height: 10px;
  margin-top: -2px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  animation: cue-step 1.6s ease-in-out infinite;
}
.scroll-cue svg + svg { animation-delay: .25s; }
@keyframes cue-step {
  0%, 100% { opacity: .2; }
  30%, 50% { opacity: 1; }
}
.scroll-cue:focus-visible { outline: 1px solid rgba(184, 137, 58, .6); outline-offset: 2px; border-radius: 6px; }

/* ───────── Loader: shown until the song has fully downloaded ───────── */
.loader { display: none; }
.js .loader {
  position: fixed;
  inset: 0;
  z-index: 90;  /* above everything, including the gate */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background:
    radial-gradient(90% 60% at 50% 45%, #FFFBF2 0%, #F6EEDC 70%, #EFE3C8 100%);
  color: #84591C;
  transition: opacity .9s ease, visibility 0s linear .9s;
}
.loader.is-done { opacity: 0; visibility: hidden; }

.loader-ring { position: relative; width: 132px; height: 132px; display: grid; place-items: center; }
.loader-progress { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); overflow: visible; }
.lp-track { fill: none; stroke: rgba(184, 137, 58, .18); stroke-width: 1; }
.lp-fill {
  fill: none;
  stroke: #B8893A;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-dasharray: 1;
  stroke-dashoffset: calc(1 - var(--p, 0));
  filter: drop-shadow(0 0 2px rgba(222, 170, 70, .55));
  transition: stroke-dashoffset .35s ease-out;
}
/* size unknown (no Content-Length): a short arc circles instead of filling */
.loader.is-indeterminate .lp-fill { stroke-dasharray: .18 .82; animation: lp-spin 1.6s linear infinite; transition: none; }
@keyframes lp-spin { to { stroke-dashoffset: -1; } }

.loader-mono { width: 74px; display: block; animation: loader-breathe 2.8s ease-in-out infinite; }
.loader-mono svg { width: 100%; height: auto; display: block; }
@keyframes loader-breathe {
  0%, 100% { opacity: .75; transform: scale(.97); }
  50%      { opacity: 1;   transform: scale(1); }
}
.loader-text {
  font-family: 'Cinzel', serif;
  font-size: 11px;
  letter-spacing: .28em;
  text-transform: uppercase;
  color: #84591C;
}
.loader-pct {
  margin-top: -10px;
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 15px;
  color: rgba(132, 89, 28, .75);
  font-variant-numeric: tabular-nums;
}
.loader.is-indeterminate .loader-pct { visibility: hidden; }

@media (prefers-reduced-motion: reduce) {
  .loader-mono, .loader.is-indeterminate .lp-fill { animation: none; }
  .scroll-cue svg { animation: none; opacity: 1; }
  .mp-wave i { animation: none; transform: scaleY(.55); }
  .music-pill::after { animation: none; opacity: 0; }
}
