/* library.css – Library grid: covers, badges, cover sizes, filters and drag and drop */

.layout {
  display: flex;
  max-width: 1700px;
  margin: auto;
}
.hd {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.hd .chips {
  margin: 0;
}
.hd .sub {
  margin: 0;
}
.hd .chips + .sub {
  margin-left: auto;
}
.case {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--min), 1fr));
  gap: 14px 12px;
}
.case {
  position: relative;
}
.bkc.abn .cover {
  filter: grayscale(0.4) brightness(0.8);
}
.bgs {
  position: absolute;
  top: 6px;
  right: 6px;
  display: flex;
  gap: 5px;
  align-items: center;
  pointer-events: none;
}
.zz {
  display: inline-flex;
  align-items: flex-end;
  gap: 1px;
  padding: 2px 7px 3px;
  border-radius: 99px;
  background: rgba(0, 0, 0, 0.65);
  color: #eee;
  font: italic 700 12px/1 var(--serif);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}
.zz i {
  font-style: italic;
  display: block;
}
.zz i:nth-child(1) {
  font-size: 0.7em;
}
.zz i:nth-child(2) {
  font-size: 0.82em;
  transform: translateY(-2px);
}
.zz i:nth-child(3) {
  font-size: 1em;
  transform: translateY(-4px);
}
.zz i:nth-child(4) {
  font-size: 1.2em;
  transform: translateY(-6px);
}
.zz i:nth-child(5) {
  font-size: 1.4em;
  transform: translateY(-8px);
}
.zz {
  padding-top: 9px;
}
.case.two .zz {
  font-size: 19px;
}
.case.s .zz {
  font-size: 7px;
}
.bkw {
  position: relative;
  transition: transform 0.24s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.bkw.hot {
  z-index: 3;
}
.bkw.placeholder {
  opacity: 0.3;
}
.case.s .dx {
  width: 16px;
  height: 16px;
  font-size: 12px;
  line-height: 16px;
  top: 4px;
  left: 4px;
}
.case.s .cap {
  font-size: 8px;
  padding: 16px 4px 4px;
}
.case.s .cap b {
  font-size: 9px;
}
.gf {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #e0e0e0;
  color: #141414;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.55);
  font-style: normal;
}
.gf svg {
  width: 14px;
  height: 14px;
}
.case.s .gf {
  width: 16px;
  height: 16px;
}
.case.s .gf svg {
  width: 10px;
  height: 10px;
}
.case.two .gf {
  width: 32px;
  height: 32px;
}
.case.two .gf svg {
  width: 19px;
  height: 19px;
}
.chip svg {
  vertical-align: -2px;
  margin-right: 4px;
}
.srt {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--mute);
}
.srt select {
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--edge);
  border-radius: 99px;
  padding: 2px 10px;
  font: inherit;
  font-size: 13px;
}
.srt option {
  background: var(--panel);
  color: var(--ink);
}
.bkw.drop-before::before,
.bkw.drop-after::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 4px;
  border-radius: 2px;
  background: var(--acc);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5);
  z-index: 4;
}
.bkw.drop-before::before {
  left: -9px;
}
.bkw.drop-after::after {
  right: -9px;
}
.ghost {
  filter: drop-shadow(0 16px 24px rgba(0, 0, 0, 0.6));
  cursor: grabbing;
  opacity: 0.97;
}
body.dragging {
  cursor: grabbing;
  user-select: none;
}
/* Touch: holding a cover picks it up, so no "save image" menu or text selection. */
.bkw {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}
.bkw img {
  -webkit-user-drag: none;
  user-select: none;
}
.bkw.hot .cover {
  box-shadow:
    inset 3px 0 0 rgba(0, 0, 0, 0.2),
    0 14px 34px var(--cs2);
}
@media (prefers-reduced-motion: reduce) {
  .bkw {
    transition: none;
  }
}
.dx {
  position: absolute;
  top: 6px;
  left: 6px;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #d64545;
  color: #fff;
  font: 700 15px/22px var(--sans);
  opacity: 0;
  transition: opacity 0.12s;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
  z-index: 2;
}
.bkw:hover .dx,
.dx:focus-visible {
  opacity: 1;
}
.dx:hover {
  background: #e55a5a;
}
@media (hover: none) {
  .dx {
    display: none;
  }
}
.bk {
  padding: 0;
  background: none;
  border: 0;
  display: block;
  width: 100%;
  text-align: left;
}
.bkc {
  position: relative;
  display: block;
  transition: transform 0.15s;
}
.rb {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #2e9e5b;
  color: #fff;
  font: 700 16px/26px var(--sans);
  text-align: center;
  font-style: normal;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.55);
}
.case.s .rb {
  width: 16px;
  height: 16px;
  font-size: 10px;
  line-height: 16px;
}
.case.two .rb {
  width: 34px;
  height: 34px;
  font-size: 21px;
  line-height: 34px;
}
.cap {
  position: absolute;
  inset: auto 0 0 0;
  padding: 26px 7px 7px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.92));
  color: #eee;
  font-size: 11px;
  line-height: 1.3;
  opacity: 0;
  transition: opacity 0.15s;
  border-radius: 0 0 4px 4px;
}
.cap b {
  display: block;
  font-size: 12px;
}
.bk:hover .cap,
.bk:focus-visible .cap {
  opacity: 1;
}
@media (hover: none) {
  .cap {
    opacity: 1;
  }
}
.cover {
  aspect-ratio: 2/3;
  width: 100%;
  border-radius: 3px 5px 5px 3px;
  background: var(--line);
  object-fit: cover;
  display: block;
  box-shadow:
    inset 3px 0 0 rgba(0, 0, 0, 0.2),
    0 2px 8px var(--cs);
}
.ph {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 8px;
  font: 600 13px/1.2 var(--serif);
  background: var(--ph);
  color: var(--phInk);
}
.empty {
  border: 1px dashed var(--edge);
  border-radius: 10px;
  padding: 36px;
  text-align: center;
  color: var(--mute);
}
.case.s {
  --min: 76px;
  gap: 8px 6px;
}
.case.two {
  --w2: min(86vw, calc((100vh - var(--hh) - 170px) * 0.6667));
  grid-template-columns: var(--w2);
  justify-content: center;
  gap: 40px;
}
.case.two .bk,
.case.r .bk {
  width: 100%;
}
.case.r {
  display: flex;
  gap: 18px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 34px 10px 14px;
  scrollbar-width: thin;
}
.case.r .bkw {
  flex: 0 0 calc((100% - 72px) / 4.5);
}
.case.r .cap {
  position: static;
  opacity: 1;
  background: none;
  color: var(--ink);
  padding: 8px 0 0;
  font-size: 13px;
  border-radius: 0;
}
.case.r .cap b {
  font: 600 15px/1.25 var(--serif);
}
.case.r .gf,
.case.r .rb {
  width: 26px;
  height: 26px;
}
.case.r .rb {
  font-size: 16px;
  line-height: 26px;
}
.case.r .gf svg {
  width: 15px;
  height: 15px;
}
.seg.sq {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-radius: 9px;
  width: 46px;
}
.seg.sq button {
  padding: 0;
  height: 22px;
  justify-content: center;
}
.seg.sq button:nth-child(odd) {
  border-right: 1px solid var(--edge);
}
.seg.sq button:nth-child(-n + 2) {
  border-bottom: 1px solid var(--edge);
}
.case.two .cap {
  position: static;
  opacity: 1;
  background: none;
  color: var(--ink);
  padding: 10px 0 0;
  font-size: 14px;
  border-radius: 0;
}
.case.two .cap b {
  font: 600 18px/1.25 var(--serif);
}
.cw {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}
.cx {
  background: none;
  border: 0;
  color: var(--mute);
  font-size: 15px;
  line-height: 1;
  padding: 0 4px;
}
.cx:hover {
  color: var(--ink);
}
.chip.add {
  border-style: dashed;
  color: var(--mute);
}
.nf {
  padding: 2px 10px;
  border-radius: 99px;
  border: 1px solid var(--edge);
  background: var(--panel);
  width: 130px;
  font-size: 13px;
}
.hd .chips {
  flex-wrap: wrap;
}
@media (max-width: 760px) {
  .case.r .bkw {
    flex-basis: 70%;
  }
  .case.s {
    --min: 58px;
  }
  .case {
    gap: 10px 8px;
  }
}
.sci {
  position: absolute;
  left: 6px;
  bottom: 6px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 99px;
  background: rgba(0, 0, 0, 0.72);
  color: #eee;
  font: 700 11px var(--sans);
  pointer-events: auto;
}
.case.s .sci {
  left: 3px;
  bottom: 3px;
  height: 14px;
  min-width: 14px;
  padding: 0 3px;
  font-size: 8px;
}
.case.s .sci svg {
  width: 8px;
  height: 8px;
}
.empty .lnk {
  display: block;
  margin: 10px auto 0;
  font-size: 13px;
  text-decoration: underline;
}

/* ---- iPhone safe areas: keep clear of the status bar, camera cut-out and home bar ---- */
.layout {
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
  padding-bottom: env(safe-area-inset-bottom);
}

/* ---- "Egen bok": round button in the bottom right corner ---- */
.fab {
  position: fixed;
  right: calc(24px + env(safe-area-inset-right));
  bottom: calc(22px + env(safe-area-inset-bottom));
  z-index: 14;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
}
.fabc {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #2e9e5b;
  color: #fff;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.55);
  transition:
    transform 0.15s,
    background 0.15s;
}
.fab:hover .fabc {
  background: #36b068;
  transform: scale(1.06);
}
.fab:focus-visible {
  outline: none;
}
.fab:focus-visible .fabc {
  outline: 2px solid var(--acc);
  outline-offset: 3px;
}
.fabl {
  padding: 1px 9px;
  border-radius: 99px;
  background: rgba(20, 20, 20, 0.88);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
/* room under the last row of covers, so the button doesn't hide them */
.case {
  margin-bottom: 100px;
}
/* keep the button beside the social panel when it is open */
body.socopen .fab {
  right: calc(444px + env(safe-area-inset-right));
}

/* ---- Narrow windows and phones ---- */
.fsel {
  display: none;
}
@media (max-width: 900px) {
  /* filters as a dropdown; order: Filtrera, Sortera, count, cover size */
  .hd .chips {
    display: none;
  }
  .hd .fsel {
    display: inline-flex;
    order: 1;
  }
  .hd .ssel {
    order: 2;
  }
  .hd .sub {
    order: 3;
  }
  .hd .seg.sq {
    order: 4;
  }
  /* Filtrera and Sortera side by side, label above; then count and size */
  .hd {
    gap: 10px 12px;
  }
  .hd .fsel,
  .hd .ssel {
    flex: 1 1 45%; /* the two fill the first row */
    min-width: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 3px;
  }
  .hd .srt select {
    width: 100%;
    min-width: 0;
  }
  .hd .sub {
    flex: 1 0 auto; /* count left, size buttons right on the second row */
  }
  /* no title and author on top of the covers */
  .case:not(.two):not(.r) .cap {
    display: none;
  }
  /* the social panel covers the whole width here */
  body.socopen .fab {
    display: none;
  }
}
