.page-library { min-height: 100vh; background: #070a0d; }
.page-library .library-head,
.page-library .library-head.is-scrolled { position: sticky; top: 0; background: rgba(7,10,13,.94); border-bottom: 1px solid rgba(255,255,255,.1); backdrop-filter: blur(18px); }
.library-main { min-height: 75vh; padding-bottom: 90px; }
.library-intro { padding-top: 76px; padding-bottom: 42px; }
.library-eyebrow { margin-bottom: 13px; color: var(--accent); font-size: .68rem; font-weight: 800; letter-spacing: .18em; text-transform: uppercase; }
.library-title-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 30px; }
.library-title-row h1 { font-size: clamp(3rem,6vw,5rem); line-height: .95; letter-spacing: -.055em; }
.library-title-row p { max-width: 620px; margin-top: 15px; color: rgba(255,255,255,.64); font-size: 1rem; line-height: 1.55; }
.library-title-row > strong { flex: none; color: rgba(255,255,255,.42); font-size: .75rem; letter-spacing: .13em; text-transform: uppercase; }
.library-controls { display: flex; align-items: center; justify-content: space-between; gap: 24px; min-height: 72px; border-top: 1px solid rgba(255,255,255,.1); border-bottom: 1px solid rgba(255,255,255,.1); }
.library-tabs { display: flex; align-items: stretch; align-self: stretch; gap: 23px; }
.library-tabs button { position: relative; border: 0; background: none; color: rgba(255,255,255,.6); font-size: .76rem; font-weight: 700; cursor: pointer; }
.library-tabs button:hover,.library-tabs button.is-on { color: #fff; }
.library-tabs button.is-on::after { content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--accent); }
.library-selects { display: flex; align-items: center; gap: 9px; }
.library-selects label { position: relative; }
.library-selects label span { position: absolute; z-index: 1; left: 14px; top: 7px; color: rgba(255,255,255,.42); font-size: .48rem; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; pointer-events: none; }
.library-selects select { width: 140px; height: 48px; padding: 16px 32px 3px 13px; border: 1px solid rgba(255,255,255,.14); border-radius: 10px; background: #10141a; color: #fff; outline: 0; font-size: .7rem; font-weight: 650; cursor: pointer; }
.library-selects select:focus { border-color: var(--accent); }
.library-results { padding-top: 30px; }
.library-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 16px; }
.library-more { margin: 38px auto 0; }
.library-empty { padding: 110px 20px; text-align: center; }
.library-empty h2 { font-size: 1.7rem; }
.library-empty p { margin-top: 8px; color: rgba(255,255,255,.55); }
.page-library .site-foot { background: #06090c; }
@media (max-width: 1060px) {
  .library-controls { align-items: stretch; flex-direction: column; padding-top: 4px; padding-bottom: 16px; }
  .library-tabs { min-height: 58px; overflow-x: auto; }
  .library-tabs button { flex: none; }
  .library-selects { width: 100%; }
  .library-selects label { flex: 1; }
  .library-selects select { width: 100%; }
  .library-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
}
@media (max-width: 680px) {
  .library-intro { padding-top: 48px; }
  .library-title-row { align-items: flex-start; flex-direction: column; }
  .library-selects { display: grid; grid-template-columns: 1fr 1fr; }
  .library-selects label:last-child { grid-column: 1/-1; }
  .library-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
}

/* Sub-tabs and selects are rebuilt per catalogue, so the row has to survive
   being empty: no controls means no border and no reserved height. */
.library-controls:has(#libraryTabs[hidden]):has(#librarySelects:empty) { display: none; }
.library-selects:empty { display: none; }
.home-product-price i {
  font-style: normal; font-size: .6rem; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase; color: rgba(255,255,255,.5);
}
.home-price-amount { display: inline-flex; align-items: baseline; gap: 5px; }

/* The sensitive-content switch sits with the filters: it narrows what you see,
   which is exactly what the controls beside it do. */
.library-nsfw {
  display: inline-flex; align-items: center; gap: 8px; height: 40px;
  padding: 0 14px; border: 1px solid var(--line-2); border-radius: 10px;
  background: transparent; color: rgba(255,255,255,.66);
  font-size: .76rem; font-weight: 600; cursor: pointer;
  transition: color .2s, border-color .2s, background .2s;
}
.library-nsfw:hover { color: #fff; border-color: rgba(255,255,255,.3); }
.library-nsfw.is-on { border-color: var(--accent-line); background: var(--accent-soft); color: var(--accent); }
.library-nsfw svg { width: 15px; height: 15px; }

/* Empty results: a way out, and something to look at. */
.library-empty { padding: 70px 0 20px; }
.library-empty p a { color: var(--accent); border-bottom: 1px solid rgba(232,100,45,.4); }
.library-empty-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 22px; }
.library-empty-actions .home-outline-btn { cursor: pointer; font: inherit; font-size: .82rem; font-weight: 700; }
.library-empty-kicker { margin: 54px 0 16px !important; color: var(--accent) !important; font-size: .68rem; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
.library-empty-picks { text-align: left; }
@media (max-width: 620px) { .library-empty-picks { grid-template-columns: 1fr 1fr; } }

/* ── filters: chips and a slim bar instead of boxed selects ─────────────── */
.library-controls { flex-direction: column; align-items: stretch; gap: 14px; min-height: 0; padding: 16px 0; }
.library-selects { display: grid; gap: 12px; width: 100%; }
.lib-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.lib-chips button { display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 14px; border: 1px solid rgba(255,255,255,.14); border-radius: 18px; background: transparent; color: rgba(255,255,255,.75); font: inherit; font-size: .8rem; font-weight: 600; cursor: pointer; transition: border-color .2s, background .2s, color .2s; }
.lib-chips button em { font-style: normal; font-size: .7rem; color: rgba(255,255,255,.4); }
.lib-chips button:hover { border-color: rgba(255,255,255,.35); color: #fff; }
.lib-chips button.is-on { border-color: #fff; background: #fff; color: #080a0c; }
.lib-chips button.is-on em { color: rgba(8,10,12,.55); }
.lib-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.lib-bar-right { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.lib-seg { display: inline-flex; padding: 3px; border: 1px solid rgba(255,255,255,.12); border-radius: 12px; background: rgba(255,255,255,.03); }
.lib-seg button { height: 32px; padding: 0 14px; border: 0; border-radius: 9px; background: transparent; color: rgba(255,255,255,.6); font: inherit; font-size: .78rem; font-weight: 700; cursor: pointer; }
.lib-seg button:hover { color: #fff; }
.lib-seg button.is-on { background: rgba(255,255,255,.1); color: #fff; }
.lib-sort { position: relative; display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 12px; border: 1px solid rgba(255,255,255,.14); border-radius: 12px; color: rgba(255,255,255,.7); }
.lib-sort svg { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; }
.lib-sort select { appearance: none; -webkit-appearance: none; border: 0; background: transparent; color: #fff; font: inherit; font-size: .8rem; font-weight: 600; padding-right: 16px; cursor: pointer; outline: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right center; background-size: 11px; }
.lib-sort select option { background: #10141a; color: #fff; }
.lib-sort:focus-within { border-color: var(--accent); }
.library-nsfw { height: 38px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (max-width: 1060px) { .library-selects { display: grid; } }
@media (max-width: 680px) {
  .library-selects { display: grid; grid-template-columns: none; }
  .lib-chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: -18px; padding-inline: 18px; }
  .lib-chips::-webkit-scrollbar { display: none; }
  .lib-chips button { flex: none; }
  .lib-bar { flex-wrap: wrap; }
  .library-nsfw span { display: none; }
  .library-nsfw { width: 38px; padding: 0; justify-content: center; }
  /* One card per row, as on the home page. */
  .library-grid { grid-template-columns: 1fr; gap: 12px; }
  .page-library .home-product { aspect-ratio: .92; }
}
.library-selects .lib-sort select { width: auto; height: auto; padding: 0 18px 0 0; border: 0; border-radius: 0; background-color: transparent; font-size: .8rem; }
.library-selects .lib-sort { flex: none; }
.library-selects .lib-sort span { position: absolute; }
/* Phone: one line under the chips. Access takes the width; sort and the
   sensitive switch shrink to icons (sort opens the phone's own picker, and a
   dot shows when it is not the default). */
@media (max-width: 680px) {
  .library-controls { gap: 12px; padding: 14px 0; }
  .lib-bar { flex-wrap: nowrap; gap: 8px; }
  .lib-seg { flex: 1; min-width: 0; }
  .lib-seg button { flex: 1; padding: 0 6px; }
  .lib-bar-right { flex: none; margin-left: 0; gap: 8px; }
  .library-selects .lib-sort { width: 40px; height: 40px; padding: 0; justify-content: center; }
  .library-selects .lib-sort svg { width: 18px; height: 18px; }
  .library-selects .lib-sort select { position: absolute; inset: 0; width: 100%; height: 100%; padding: 0; opacity: 0; }
  .lib-sort.is-set::after { content: ''; position: absolute; top: 7px; right: 7px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
  .library-nsfw { width: 40px; height: 40px; }
}
