/* Library page. The accordion rules are shared with gallery.html (copied from its <style>). */
.album-tools { display: flex; flex-wrap: wrap; gap: .75rem 1.5rem; align-items: center; justify-content: space-between; }
.acc-all { display: flex; gap: .5rem; }
.acc-all button { font: 600 .85rem/1 var(--body); padding: .55rem 1rem; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--rule); background: var(--paper); color: var(--ink); }
.acc-all button:hover { border-color: var(--gold); }
.albums { display: grid; gap: .75rem; padding-block: 2.5rem 3.5rem; }
.acc { background: var(--paper); border: 1px solid var(--rule); border-radius: 10px; scroll-margin-top: 6rem; overflow: hidden; }
.acc[open] { border-color: color-mix(in srgb, var(--gold) 45%, var(--rule)); }
.acc > summary { list-style: none; cursor: pointer; display: grid; align-items: center; gap: .9rem 1.25rem;
  grid-template-columns: auto minmax(0, 1fr) auto; padding: 1rem 1.1rem; }
.acc > summary::-webkit-details-marker { display: none; }
.acc > summary:hover .acc-title { color: var(--leaf); }
.acc-covers { position: relative; width: 6.4rem; height: 4.6rem; flex: none; }
.acc-covers img { position: absolute; top: .3rem; width: 3.9rem; height: 3.9rem; object-fit: cover; border-radius: 6px;
  border: 2px solid var(--paper); box-shadow: 0 2px 6px rgb(0 0 0 / .18); transition: transform .3s ease; }
.acc-covers img:nth-child(1) { left: 0; transform: rotate(-7deg); }
.acc-covers img:nth-child(2) { left: 1.25rem; transform: rotate(2deg); z-index: 1; }
.acc-covers img:nth-child(3) { left: 2.5rem; transform: rotate(8deg); z-index: 2; }
.acc[open] .acc-covers img:nth-child(1) { transform: translateX(-.2rem) rotate(-11deg); }
.acc[open] .acc-covers img:nth-child(3) { transform: translateX(.2rem) rotate(12deg); }
.acc-text { display: grid; gap: .15rem; min-width: 0; }
.acc-title { margin: 0; font: 600 1.35rem/1.25 var(--display); color: var(--ink); text-wrap: balance; }
html[lang="th"] .acc-title { font-family: var(--thai); }
.acc-desc { color: var(--muted); font-size: .95rem; }
.acc-side { display: flex; align-items: center; gap: .8rem; }
.acc-count { font-size: .82rem; font-weight: 600; padding: .3rem .7rem; border-radius: 999px; background: var(--gold-soft);
  color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.acc-chev { width: 2.1rem; height: 2.1rem; border-radius: 50%; border: 1.5px solid var(--gold); display: grid; place-items: center;
  color: var(--gold); transition: transform .3s ease, background .3s ease; }
.acc-chev svg { width: 1rem; height: 1rem; }
.acc[open] .acc-chev { transform: rotate(180deg); background: var(--gold); color: var(--paper); }
.acc-body { padding: .25rem 1.1rem 1.25rem; border-top: 1px solid var(--rule); }
.mosaic { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 10.5rem), 1fr)); grid-auto-flow: dense; padding-top: 1rem; }
@media (min-width: 44rem) { .mosaic .photo.thumb:first-child { grid-column: span 2; grid-row: span 2; } }
.mosaic .photo.thumb { border-radius: 6px; }
.mosaic .photo.thumb:not(.missing) figcaption { display: block; position: absolute; inset: auto 0 0; padding: 1.6rem .7rem .55rem;
  background: linear-gradient(transparent, rgb(12 12 22 / .78)); color: #f4f1e6; font-size: .8rem; line-height: 1.35;
  opacity: 0; transition: opacity .25s ease; pointer-events: none; }
.mosaic .photo.thumb:not(.missing) figcaption span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mosaic .photo.thumb:not(.missing) figcaption code { display: none; }
.mosaic .photo.thumb:hover figcaption, .mosaic .photo.thumb:focus-visible figcaption { opacity: 1; }
@media (hover: none) { .mosaic .photo.thumb:not(.missing) figcaption { opacity: 1; } }
.lb-count { font-size: .82rem; opacity: .75; font-variant-numeric: tabular-nums; }
@media (max-width: 34rem) {
  .acc > summary { grid-template-columns: minmax(0, 1fr) auto; }
  .acc-covers { display: none; }
  .acc-title { font-size: 1.15rem; }
  .acc-desc { font-size: .88rem; }
}
@media (prefers-reduced-motion: reduce) { .acc-covers img, .acc-chev, .mosaic figcaption { transition: none; } }

/* ---------- Library ---------- */
.lib-jump { display: flex; flex-wrap: wrap; gap: .5rem; }
.lib-sec { display: grid; gap: 1.5rem; padding-block: 3rem; border-bottom: 1px solid var(--rule); scroll-margin-top: 6rem; }
.lib-sec > .dl-head h2 { margin: 0 0 .5rem; }
.lib-count { color: var(--leaf); font-weight: 600; font-size: .95rem; font-variant-numeric: tabular-nums; }
.lib-pending { background: var(--gold-soft); border-left: 4px solid var(--gold); border-radius: 6px; padding: .8rem 1.1rem; font-size: .95rem; }
.lib-list { display: grid; gap: .6rem; }
.acc.set { border-radius: 8px; box-shadow: none; }
.acc.set > summary { padding: .7rem .9rem; }
.acc.set .acc-title { font: 600 1.05rem/1.3 var(--body); }
html[lang="th"] .acc.set .acc-title { font-family: var(--thai); }
.acc.set .acc-chev { width: 1.7rem; height: 1.7rem; }
.acc.coll > .acc-body, .acc.album > .acc-body { display: grid; gap: .5rem; padding-top: 1rem; }
.acc.coll > summary, .acc.album > summary, .acc.set > summary { grid-template-columns: minmax(0, 1fr) auto; }
.acc.set > .acc-body { padding: 0 .9rem .5rem; }
.lt-list { list-style: none; margin: 0; padding: 0; }
.lt { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: .4rem .9rem; padding: .65rem 0; border-bottom: 1px solid var(--rule); }
.lt:last-child { border-bottom: 0; }
.lt-play { width: 2.4rem; height: 2.4rem; border-radius: 50%; border: 1.5px solid var(--leaf); background: transparent; color: var(--leaf);
  display: grid; place-items: center; cursor: pointer; flex: none; padding: 0; }
.lt-play svg { width: 1.05rem; height: 1.05rem; }
.lt-play:hover, .lt-play.on { background: var(--leaf); color: var(--on-dark); }
.lt-text { min-width: 0; }
.lt-title { margin: 0; line-height: 1.4; overflow-wrap: anywhere; }
html[lang="th"] .lt-title, .lt-title { font-family: var(--body), "Noto Sans Thai", sans-serif; }
.lt-n { display: inline-block; min-width: 1.9rem; color: var(--muted); font-size: .85rem; font-variant-numeric: tabular-nums; }
.lt-meta { margin: .1rem 0 0; color: var(--muted); font-size: .82rem; }
.lt-dl { padding: .45rem .8rem; font-size: .85rem; }
.lt-dl svg { width: 16px; height: 16px; }
#lib-results { border-top: 1px solid var(--rule); }
#lib-results-info { color: var(--muted); margin: 0; }
.lib-year { margin: 1.2rem 0 .2rem; font: 600 1.15rem/1.2 var(--display); color: var(--red); }
.lib-year:first-child { margin-top: 0; }
.lib-mosaic .photo.thumb:first-child { grid-column: auto; grid-row: auto; }
.lib-more { justify-self: center; margin-top: .5rem; }
.lb-save { color: #f4f1e6; font-size: .9rem; font-weight: 600; }
.lb-save:hover { color: #f0a63a; }
.lib-videos { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem 2rem; }
.lib-videos p { margin: 0; color: var(--muted); max-width: 40rem; }
/* player bar */
.lib-player { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(env(safe-area-inset-bottom, 0px) + .75rem); z-index: 20;
  width: min(44rem, calc(100% - 1.5rem)); background: var(--paper); border: 1px solid var(--rule); border-top: 3px solid var(--gold);
  border-radius: 10px; box-shadow: 0 8px 28px rgb(0 0 0 / .22); padding: .6rem .8rem; display: grid; gap: .3rem; }
.lib-player[hidden] { display: none; }
.lp-row { display: flex; align-items: center; gap: .6rem; }
.lp-title { flex: 1; min-width: 0; margin: 0; font-weight: 600; font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lp-close { border: 0; background: none; color: var(--muted); font-size: 1.5rem; line-height: 1; cursor: pointer; padding: 0 .3rem; }
.lib-player audio { width: 100%; height: 2.4rem; }
body:has(.lib-player:not([hidden])) .site-foot { padding-bottom: 7rem; }
@media (max-width: 34rem) {
  .lt { grid-template-columns: auto minmax(0, 1fr); }
  .lt-dl { grid-column: 2; justify-self: start; }
}
.lib-more[hidden] { display: none; }
.acc.set:not([open]) .acc-chev { transform: none; background: transparent; color: var(--gold); }
