/* Personal gallery: covers above titles, with one shared reading area per row. */
[hidden] { display: none !important; }
#stories-block, #stories-block *, #music-block, #music-block * { font-family: 'Noto Serif SC', 'Songti SC', STSong, SimSun, serif; }
#favorites > h2 { font-size: 30px; margin: 0 0 36px; }
.shelf-heading h3, #music-block > h3 { font-size: 30px; margin: 0; }
.shelf-heading h3, #music-block > h3 { margin-bottom: 36px; }
#music-block { margin-top: 80px; }
.shelf-intro { color: var(--muted); line-height: 1.8; margin: 16px 0 36px; }
.shelf-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 40px 52px; max-width: 820px; align-items: start; }
.shelf-card { min-width: 0; scroll-margin-top: 90px; }
.shelf-card-button { display: block; width: 100%; max-width: 220px; padding: 0; border: 0; background: none; color: var(--fg); text-align: left; font: inherit; cursor: pointer; }
.shelf-cover { width: 100%; box-sizing: border-box; aspect-ratio: 2 / 3; position: relative; display: grid; place-items: center; background: color-mix(in srgb, var(--fg) 5%, var(--bg)); border: 1px solid var(--line); overflow: hidden; }
.shelf-cover-placeholder { padding: 16px; font-size: 16px; line-height: 1.8; text-align: center; overflow-wrap: anywhere; color: var(--muted); }
.shelf-cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: var(--bg); }
.shelf-title { display: block; font-size: 19px; margin: 16px 0 8px; line-height: 1.6; overflow-wrap: anywhere; }
.shelf-excerpt { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 13px; line-height: 1.9; color: var(--muted); overflow-wrap: anywhere; }
.shelf-card-button:hover .shelf-title { text-decoration: underline; text-underline-offset: 5px; }
.shelf-card-button[aria-expanded=true] .shelf-title { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 5px; }
.shelf-card-button:focus-visible, .shelf-close:focus-visible { outline: 2px solid var(--fg); outline-offset: 6px; }
.shelf-expanded { grid-column: 1 / -1; min-width: 0; width: 100%; max-width: 620px; box-sizing: border-box; padding: 18px 0 8px; border-top: 1px solid var(--line); }
.shelf-expanded.is-animating { overflow: hidden; }
.shelf-expanded-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.shelf-expanded h3 { margin: 0; font-size: 17px; font-weight: 400; line-height: 1.6; overflow-wrap: anywhere; }
.shelf-close { flex-shrink: 0; border: 0; background: none; color: var(--muted); font: inherit; font-size: 12px; padding: 8px 0; cursor: pointer; }
.shelf-close:hover { color: var(--fg); text-decoration: underline; text-underline-offset: 4px; }
.shelf-recommendation { font-size: 15px; line-height: 1.9; overflow-wrap: anywhere; margin: 0 0 20px; }
.shelf-recommendation p { margin: 0 0 14px; white-space: pre-line; }
.shelf-recommendation p:last-child { margin-bottom: 0; }
.shelf-meta { font-size: 12px; line-height: 1.8; color: var(--muted); margin: 0; overflow-wrap: anywhere; }
.shelf-essay { display: inline-block; margin-top: 12px; color: var(--fg); text-underline-offset: 5px; font-size: 13px; }
@media (max-width: 1000px) { nav .links { gap: 20px; } }
@media (max-width: 600px) {
  .shelf-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px 24px; }
  .shelf-title { font-size: 17px; margin-top: 12px; }
  #favorites > h2, .shelf-heading h3, #music-block > h3 { font-size: 25px; }
  #music-block { margin-top: 60px; }
  .shelf-expanded { padding: 14px 0 4px; }
  .shelf-expanded-heading { gap: 12px; }
  .shelf-expanded h3 { font-size: 16px; }
}

/* Music cards share the shelf grid but use square artwork. */
.music-cover { aspect-ratio: 1; }
.music-cover img { object-fit: cover; }
.music-play { position: absolute; z-index: 1; inset: 0; display: grid; place-items: center; background: rgba(0,0,0,.35); color: white; font-size: 30px; opacity: 0; transition: opacity .2s; }
.music-card-button:hover .music-play, .music-card-button:focus-visible .music-play { opacity: 1; }

.music-row.is-playing .music-play, .music-row.is-paused .music-play { opacity: 1; }
.mini-player { position: fixed; z-index: 100; bottom: 0; left: 0; right: 0; display: flex; align-items: center; gap: 16px; padding: 12px 24px; background: var(--bg); color: var(--fg); border-top: 1px solid var(--line); }
.mini-cover { position: relative; width: 52px; height: 52px; flex: none; display: grid; place-items: center; background: var(--line); }
.mini-cover img { position: absolute; width: 100%; height: 100%; object-fit: cover; }
.mini-info { display: flex; flex-direction: column; min-width: 0; width: 220px; }
.mini-info span { color: var(--muted); font-size: 12px; }
.mini-controls { display: flex; gap: 8px; }
.mini-controls button { cursor: pointer; border: 0; background: none; color: var(--fg); font-size: 18px; padding: 8px; }
.mini-controls button:disabled { opacity: .3; cursor: default; }
.mini-progress { display: flex; align-items: center; gap: 8px; flex: 1; font-size: 12px; }
.mini-progress input { flex: 1; min-width: 0; }
@media (max-width: 600px) { .mini-player { flex-wrap: wrap; gap: 4px 12px; padding: 8px 16px; } .mini-info { flex: 1; } .mini-progress { flex-basis: 100%; } }

.music-row .shelf-title, .music-row .shelf-excerpt, .mini-info strong, .mini-info span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.mini-player { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
body.music-player-visible { padding-bottom: calc(100px + env(safe-area-inset-bottom)); }
body.music-player-visible .support-fab { bottom: calc(100px + env(safe-area-inset-bottom)) !important; }
html.dark .mini-player { background: var(--bg); border-color: var(--line); }
@media (max-width: 600px) {
  .mini-player { padding-bottom: calc(8px + env(safe-area-inset-bottom)); }
  body.music-player-visible { padding-bottom: calc(130px + env(safe-area-inset-bottom)); }
  body.music-player-visible .support-fab { bottom: calc(130px + env(safe-area-inset-bottom)) !important; }
}
@media (prefers-reduced-motion: reduce) { .music-play { transition: none; } }
