/* ============ MOTION LAYER ============
   Site-wide upgrades on top of styles.css. Everything is scoped under
   html.fx (set by motion.js), so without JS the page is the old one.
   - masked word reveals on section titles
   - scroll-lit "More than yesterday" statement
   - reasons as a sticky stack of layered cards (mobile)
   - gallery lightbox that grows out of the tapped photo
   - reading-progress line inside the nav capsule */

/* ---- Masked word titles ---- */
.fx .mt .mw {
  display: inline-block;
  overflow: hidden;
  vertical-align: top;
  padding: 0.14em 0.04em 0.16em;
  margin: -0.14em -0.04em -0.16em;
}
.fx .mt .mw-i {
  display: inline-block;
  transform: translate3d(0, 108%, 0);
  transition: transform 1.05s var(--ease-out-strong) calc(0.08s + var(--i, 0) * 55ms);
}
.fx .mt.is-in .mw-i { transform: none; }
.fx .mt .mw-punct { color: var(--ink); }

/* ---- Scroll-lit statement ---- */
.fx .big-statement.lit-scrub .mw-i {
  opacity: 0.14;
  transition: opacity 0.45s ease;
}
.fx .big-statement.lit-scrub .mw-i.is-lit { opacity: 1; }
.fx .big-statement.lit-scrub em .mw-i.is-lit {
  text-shadow: 0 0 28px rgba(217, 108, 138, 0.35);
}

/* ---- Hover only where hover exists ---- */
.fx .bento-shell:hover { transform: none; }
@media (hover: hover) and (pointer: fine) {
  .fx .bento-shell:hover { transform: translateY(-6px); }
}

/* ---- Reasons: sticky layered stack (phones) ---- */
@media (max-width: 767px) and (min-height: 620px) {
  .fx .bento { gap: 1.4rem; }
  .fx .bento-shell {
    --i: 0;
    position: sticky;
    top: calc(5.4rem + var(--i) * 12px);
    align-self: start;
    background: #FBEFF2;
    border-color: rgba(217, 108, 138, 0.16);
  }
  .fx .bento-shell:nth-child(2) { --i: 1; }
  .fx .bento-shell:nth-child(3) { --i: 2; }
  .fx .bento-shell:nth-child(4) { --i: 3; }
  .fx .bento-shell:nth-child(5) { --i: 4; }
  .fx .bento-shell:nth-child(6) { --i: 5; }
  .fx .bento-card {
    position: relative;
    transform-origin: 50% 0%;
    will-change: transform;
  }
  /* covered cards sink back and blush, like the rims in the opening reel */
  .fx .bento-card::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(180deg, rgba(232, 160, 176, 0.55), rgba(246, 220, 227, 0.85));
    opacity: var(--cover, 0);
    pointer-events: none;
  }
  .fx .reasons { padding-bottom: 9rem; }
}

/* ---- Gallery lightbox ---- */
.fx .gallery .photo-frame { cursor: zoom-in; -webkit-tap-highlight-color: transparent; }
.fx .gallery .photo-frame img.is-lifted { visibility: hidden; }

html.lb-lock, html.lb-lock body { overflow: hidden; }

.lb {
  position: fixed;
  inset: 0;
  z-index: 90;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}
.lb[hidden] { display: none; }
.lb-backdrop {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(124, 43, 63, 0.92), rgba(27, 9, 16, 0.97) 70%);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  opacity: 0;
  transition: opacity 0.4s var(--ease-out-strong);
}
.lb.is-open .lb-backdrop { opacity: 1; }
.lb-img {
  position: fixed;
  display: block;
  object-fit: cover;
  border-radius: 1.2rem;
  transform-origin: 0 0;
  box-shadow: 0 40px 90px -30px rgba(0, 0, 0, 0.7);
  will-change: transform;
  backface-visibility: hidden;
}
.lb-top,
.lb-foot {
  position: absolute;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.1rem;
  color: var(--maroon-paper);
  opacity: 0;
  transition: opacity 0.35s ease;
}
.lb.is-open .lb-top,
.lb.is-open .lb-foot { opacity: 1; transition-delay: 0.15s; }
.lb-top { top: max(env(safe-area-inset-top), 1rem); }
.lb-foot { bottom: calc(max(env(safe-area-inset-bottom), 1rem) + 0.2rem); }
.lb-count {
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  font-variant-numeric: tabular-nums;
  color: rgba(255, 249, 244, 0.7);
}
.lb-cap {
  flex: 1;
  font-size: 1.05rem;
  font-weight: 700;
  text-align: center;
  min-height: 1.6em;
}
.lb-btn {
  width: 2.6rem;
  height: 2.6rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(255, 249, 244, 0.16);
  background: rgba(255, 249, 244, 0.08);
  color: var(--maroon-paper);
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.16s var(--ease-out-strong);
}
.lb-btn:active { transform: scale(0.94); }
.lb-btn svg {
  width: 1.1rem;
  height: 1.1rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
@media (hover: hover) and (pointer: fine) {
  .lb-btn:hover { background: rgba(255, 249, 244, 0.18); }
}
.lb-hint {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(max(env(safe-area-inset-bottom), 1rem) + 3.6rem);
  text-align: center;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: rgba(255, 249, 244, 0.45);
  opacity: 0;
  transition: opacity 0.5s ease;
}
.lb.is-open .lb-hint { opacity: 1; transition-delay: 0.6s; }
.lb.was-swiped .lb-hint { opacity: 0; transition-delay: 0s; }

/* ---- Nav reading progress ---- */
.nav-progress {
  position: absolute;
  left: 1.3rem;
  right: 1.3rem;
  bottom: 3px;
  height: 2px;
  border-radius: 2px;
  background: rgba(217, 108, 138, 0.12);
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.5s ease;
}
.nav-progress i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--rose-soft), var(--rose));
  transform: scaleX(0);
  transform-origin: left center;
}
body.site-open .nav-progress { opacity: 1; }

/* ---- Songs ---- */
.fx-discs .song-disc img { animation: none; will-change: transform; }
.fx .song-disc-shell {
  transition: transform 0.6s var(--ease-out-strong), box-shadow 0.6s ease;
}
.fx .playlist.has-center .song.reveal.in:not(.is-center) { opacity: 0.42; }
.fx .playlist.has-center .song.reveal.in { transition: opacity 0.5s ease, transform 1s var(--ease-fluid), filter 1s var(--ease-fluid); }
.fx .song.is-center .song-disc-shell {
  transform: scale(1.07);
  box-shadow: 0 0 0 6px rgba(217, 108, 138, 0.08), 0 24px 50px -18px rgba(217, 108, 138, 0.55);
}
.fx .song .song-meta h3 { transition: color 0.5s ease; }
.fx .song.is-center .song-meta h3 { color: var(--rose); }
.fx .flow-arrow { --draw: 0; }
.fx .flow-arrow svg { clip-path: inset(0 0 calc(100% - var(--draw) * 100%) 0); }

/* ---- Forever heart ripple ---- */
.fx .heart-btn { position: relative; }
.heart-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--rose-soft);
  pointer-events: none;
}

/* ---- Hover only where hover exists ---- */
@media (hover: none) {
  .fx .heart-btn:hover,
  .fx .star-btn:hover { transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .fx .mt .mw-i { transform: none; }
  .fx .big-statement.lit-scrub .mw-i { opacity: 1; }
  .fx .bento-card { transform: none !important; }
}
