/* Library record crates (mockup: docs/mockups/vinyl-library-preview.html) */
/* ——— Header ——— */
.eyebrow { font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: var(--gold-ink); margin: 0; }
.lozenge { display: inline-block; flex: none; width: 7px; height: 7px; background: currentColor; -webkit-mask: var(--lozenge-mask) center / contain no-repeat; mask: var(--lozenge-mask) center / contain no-repeat; }
.lib-header { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: 12px 20px 0; max-width: 768px; margin: 0 auto; }
.lib-header h1 { font-size: 36px; line-height: 1.1; margin: 4px 0 0; }
.account { position: relative; }
.avatar { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border-radius: 50%; border: 1px solid var(--gold-soft); background: var(--surface-sunken); color: var(--ink); cursor: pointer; font: 600 21px var(--font-display); box-shadow: inset 0 0 0 2px var(--surface-sunken), inset 0 0 0 3px var(--gold-faint); }
.account-menu { width: min(220px, calc(100vw - 40px)); top: calc(100% + 6px); right: 0; }
.menu-item--action { grid-template-columns: 20px 1fr; }
a.menu-item { text-decoration: none; }
.menu-item.menu-item--signout { font-family: var(--font-display); font-weight: 600; }
.menu-item.menu-item--action .icon { visibility: visible; color: var(--ink-muted); }

/* ——— Hero "Nghe tiếp": the one ornate card on this screen ——— */
.ornate.hero { display: grid; grid-template-columns: 1fr 138px; gap: 8px; align-items: center; margin-top: var(--space-2); padding: 26px 18px 22px 22px; overflow: hidden; border-radius: 2px;
  background: radial-gradient(90% 120% at 100% 0, var(--highlight), transparent 70%), var(--surface); }
.hero-text { min-width: 0; }
.hero .eyebrow { display: flex; align-items: center; gap: 7px; }
.hero-title { font-size: 25px; line-height: 1.28; margin: 4px 0; padding-top: .1em; text-wrap: balance; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.hero-meta { font-size: 13px; color: var(--ink-muted); font-variant-numeric: tabular-nums; margin: 0; }
.hero .btn { margin-top: 14px; padding-inline: 12px; white-space: nowrap; }
.hero-art { position: relative; height: 112px; }
.hero-art .disc { position: absolute; width: 96px; top: 8px; left: 38px; }
.hero-art .sleeve { position: absolute; width: 100px; top: 6px; left: 0; z-index: 1; }

/* ——— Search + toolbar ——— */
.search { position: relative; margin: 22px 0 10px; }
.search .icon { position: absolute; left: 12px; top: 50%; translate: 0 -50%; color: var(--ink-muted); pointer-events: none; display: flex; }
.search input { width: 100%; min-height: 44px; padding: 10px 12px 10px 38px; border: 1px solid var(--gold-soft); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); font: inherit; font-size: 16px; box-shadow: inset 0 1px 2px rgba(31, 27, 22, .05); }
.search input:focus { outline: none; border-color: var(--primary); box-shadow: inset 0 1px 2px rgba(31, 27, 22, .05), 0 0 0 3px var(--gold-faint); }
.lib-toolbar { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 2px; }
.lib-summary { margin: 0; font-size: 13px; color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.menu-btn { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; max-width: 60%; margin-right: -8px; padding: 0 8px 0 12px; border: 0; background: none; color: var(--primary); cursor: pointer; font: inherit; font-size: 15px; font-weight: 600; }
.menu-btn span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-btn .icon { display: flex; flex: none; }
.menu-btn:active { opacity: .55; }

/* Pull-down menu (topic filter + account) */
.menu-scrim { position: fixed; inset: 0; z-index: 9; }
.menu { position: absolute; right: -4px; top: calc(100% + 2px); z-index: 10; width: min(270px, calc(100vw - 40px)); max-height: 56vh; overflow-y: auto; overscroll-behavior: contain; padding: 4px 0;
  background: var(--surface); border: 1px solid var(--gold-soft); border-radius: 10px; transform-origin: top right;
  box-shadow: inset 0 0 0 3px var(--surface), inset 0 0 0 4px var(--gold-faint), 0 14px 36px rgba(31, 27, 22, .22); }
@media (prefers-reduced-motion: no-preference) { .menu { animation: menu-in 170ms cubic-bezier(.2, .9, .3, 1.2); } }
@keyframes menu-in { from { opacity: 0; transform: scale(.85); } }
.menu-heading { padding: 7px 16px 5px; font: 600 13px/1.5 var(--font-display); letter-spacing: .14em; text-transform: uppercase; color: var(--gold-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-item { display: grid; grid-template-columns: 20px 1fr auto; align-items: center; gap: 10px; width: 100%; min-height: 46px; padding: 0 16px 0 14px; border: 0; border-top: 1px solid var(--gold-faint); background: none; color: var(--ink); cursor: pointer; text-align: left; font: inherit; font-size: 16px; }
.menu-item span:not(.icon) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-item .icon { display: flex; color: var(--primary); visibility: hidden; }
.menu-item[aria-checked='true'] { font-weight: 600; }
.menu-item[aria-checked='true'] .icon { visibility: visible; }
.menu-item small { font-size: 14px; color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.menu-item:active { background: var(--surface-sunken); }
.menu-item:focus-visible { outline-offset: -3px; }

/* ——— Crates: the tab sticks under the top edge while its row of records scrolls past ——— */
.crate-wrap { margin-top: 18px; }
.crate-head { position: sticky; top: 0; z-index: 3; margin: 0 -20px; padding: 8px 20px 0; background: var(--bg); }
.crate-tab { position: relative; top: 1px; display: inline-flex; align-items: baseline; gap: 8px; margin: 0; padding: 6px 16px 5px; background: var(--surface-sunken); border: 1px solid var(--gold-soft); border-bottom: 0; border-radius: 3px 10px 0 0;
  font: 600 15px/1.35 var(--font-display); letter-spacing: .12em; text-transform: uppercase; color: var(--gold-ink); font-variant-numeric: lining-nums; white-space: nowrap; }
.crate-tab::before { content: ''; width: 7px; height: 7px; align-self: center; background: var(--gold); -webkit-mask: var(--lozenge-mask) center / contain no-repeat; mask: var(--lozenge-mask) center / contain no-repeat; }
.crate-tab small { font: 500 12px var(--font-ui); letter-spacing: 0; text-transform: none; color: var(--ink-muted); }
.crate { position: relative; padding: 18px 0 0; background: var(--surface-sunken); border: 1px solid var(--gold-soft); border-radius: 0 3px 3px 3px; box-shadow: inset 0 0 0 3px var(--surface-sunken), inset 0 0 0 4px var(--gold-faint); }
.crate-row { display: flex; gap: 14px; overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: none; padding: 0 16px 16px; scroll-padding-inline: 16px; }
.crate-row::-webkit-scrollbar { display: none; }
.rec { flex: 0 0 146px; min-width: 0; scroll-snap-align: start; display: block; color: inherit; text-decoration: none; }
.rec-art { position: relative; height: 118px; }
.rec-art .sleeve { position: absolute; left: 0; top: 0; width: 118px; z-index: 1; }
.rec-art .disc { position: absolute; width: 108px; top: 5px; left: 36px; transition: transform 250ms ease-out; }
.rec:hover .rec-art .disc, .rec:focus-visible .rec-art .disc { transform: translateX(6px); }
.rec-meta { width: 118px; padding-top: 10px; }
.rec-title { font-family: var(--font-display); font-size: 15px; font-weight: 600; line-height: 1.45; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rec-by { font-size: 12px; color: var(--ink-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rec-progress { height: 3px; margin-top: 6px; background: var(--border); border-radius: 1px; overflow: hidden; }
.rec-progress span { display: block; height: 100%; background: var(--primary); }
.rec-build-progress { height: 3px; margin-top: 6px; background: var(--border); border-radius: 1px; overflow: hidden; }
.rec-build-progress span { display: block; height: 100%; background: var(--gold); }
.rec-state { display: inline-flex; align-items: flex-start; gap: 4px; margin-top: 4px; font-size: 12px; color: var(--ink-muted); }
.rec-state .icon { display: flex; margin-top: 2px; }
.rec-state--ready { color: var(--success); }
.rec-state--failed { color: var(--danger); }
@media (min-width: 768px) { .crate-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(146px, 1fr)); overflow: visible; } }
@media (prefers-reduced-motion: reduce) { .rec-art .disc { transition: none; } .rec:hover .rec-art .disc, .rec:focus-visible .rec-art .disc { transform: none; } }

.lib-end { width: 120px; margin: 28px auto 0; }
.lib-empty { text-align: center; padding: 40px 10px; color: var(--ink-muted); }
.crate-skeleton { height: 220px; margin-top: var(--space-6); border-radius: 3px; }
.empty-state { text-align: center; padding: var(--space-12) var(--space-4); color: var(--ink-muted); }
.empty-state svg { color: var(--gold); margin-bottom: var(--space-2); }
.empty-state .fleuron-rule { max-width: 200px; margin-inline: auto; }

@media (max-width: 380px) {
  .lib-header { padding-inline: 14px; }
  .ornate.hero { grid-template-columns: 1fr 112px; padding-inline: 18px 12px; }
  .hero-art .sleeve { width: 84px; } .hero-art .disc { width: 80px; left: 32px; }
  .hero-title { font-size: 22px; }
}
