/* Quick bookmark (assets/scripts/quick-bookmark.js): the + on series covers and the "Add to reading list" dialog
   (a centred dialog from 768px, the site's bottom sheet below — see the end of the file).
   Colours are the site tokens + the viewer's zmio-synced accent (--zmio-accent-*), violet when they have none. The
   radius level and the plain-border option reach these through ui-radius.css / ui-plain.css. */

/* ── the + on a cover ── */
.qb-btn, .qb-modal, .qb-modal *, .qb-dialog, .qb-dialog * { box-sizing: border-box; }
:where(.qb-host) { position: relative; } /* zero specificity: only lifts a box that had no positioning of its own */

.qb-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    z-index: 6;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid rgb(255 255 255 / .2);
    border-radius: 9999px;
    background: rgb(0 0 0 / .55);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    color: #fff;
    font: 700 16px/1 system-ui, sans-serif;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: transform .15s ease, background-color .15s ease, border-color .15s ease;
}
.qb-btn:hover { transform: scale(1.1); background: rgb(0 0 0 / .75); border-color: rgb(255 255 255 / .4); }
.qb-btn:active { transform: scale(.94); }
.qb-btn:focus-visible { outline: 2px solid var(--zmio-accent-soft, #a78bfa); outline-offset: 2px; }
.qb-btn.is-on { border-color: transparent; background: var(--zmio-accent-pill-bg, var(--scheme-pill, linear-gradient(135deg, rgb(109, 40, 217), rgb(167, 139, 250)))); }
.qb-btn .qb-btn-ico { width: 15px; height: 15px; pointer-events: none; }

/* ── the dialog ── (the state classes is-busy / is-loading sit on the panel: as a sheet it is outside .qb-modal) */
html.qb-open { overflow: hidden; }

.qb-modal { position: fixed; inset: 0; z-index: 10000; display: flex; align-items: center; justify-content: center; padding: 16px; }
.qb-modal[hidden] { display: none; }
.qb-backdrop { position: absolute; inset: 0; background: rgb(0 0 0 / .65); opacity: 0; transition: opacity .18s ease; }
.qb-dialog {
    position: relative;
    width: 100%;
    max-width: 380px;
    max-height: calc(100vh - 32px);
    max-height: calc(100dvh - 32px);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 16px;
    border-radius: 1rem;
    border: 1px solid rgb(var(--c-white) / .09);
    background: rgb(var(--c-surface-2));
    box-shadow: 0 24px 80px rgb(0 0 0 / .6);
    opacity: 0;
    transform: translateY(8px) scale(.98);
    transition: opacity .18s ease, transform .18s ease;
}
.qb-modal.is-open .qb-backdrop { opacity: 1; }
.qb-modal.is-open .qb-dialog { opacity: 1; transform: none; }

.qb-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.qb-cover { flex: none; width: 44px; aspect-ratio: 2 / 3; border-radius: .375rem; overflow: hidden; background: rgb(var(--c-white) / .06); }
.qb-cover[hidden] { display: none; }
.qb-cover img { display: block; width: 100%; height: 100%; max-width: none; object-fit: cover; }
.qb-head-text { flex: 1 1 auto; min-width: 0; }
.qb-eyebrow { margin: 0 0 2px; font-size: 10px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--zmio-accent-light, rgb(var(--c-violet-soft))); }
.qb-title { margin: 0; font-size: 15px; line-height: 1.3; font-weight: 700; color: rgb(var(--c-white)); display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.qb-x { flex: none; align-self: flex-start; display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; padding: 0; border: 0; border-radius: .5rem; background: transparent; color: rgb(var(--c-white) / calc(var(--ta-b, 0) + var(--ta-m, 1) * .45)); font-size: 20px; line-height: 1; cursor: pointer; transition: color .15s ease, background-color .15s ease; }
.qb-x:hover { color: rgb(var(--c-white)); background: rgb(var(--c-white) / .06); }
.qb-x svg { width: 18px; height: 18px; }

.qb-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.qb-opt {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    padding: 8px 10px 8px 8px;
    border: 1px solid rgb(var(--c-white) / .08);
    border-radius: .625rem;
    background: rgb(var(--c-white) / .04);
    color: var(--qb-c);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background-color .15s ease, border-color .15s ease, opacity .15s ease;
}
.qb-opt:hover { background: rgb(var(--c-white) / .08); }
.qb-opt:focus-visible, .qb-remove:focus-visible, .qb-x:focus-visible { outline: 2px solid var(--zmio-accent-soft, #a78bfa); outline-offset: 2px; }
.qb-opt.is-on { border-color: var(--qb-c); background: var(--qb-bg); }
.qb-ico { flex: none; display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: .5rem; background: var(--qb-bg); }
.qb-ico svg { width: 16px; height: 16px; }
.qb-label { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qb-check { flex: none; display: none; }
.qb-check svg { width: 16px; height: 16px; }
.qb-opt.is-on .qb-check { display: flex; }

.qb-remove { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; margin-top: 10px; padding: 9px 12px; border: 0; border-radius: .625rem; background: transparent; color: rgb(var(--c-white) / calc(var(--ta-b, 0) + var(--ta-m, 1) * .45)); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; transition: color .15s ease, background-color .15s ease; }
.qb-remove[hidden] { display: none; }
.qb-remove:hover { color: rgb(var(--c-red)); background: rgb(var(--c-white) / .05); }
.qb-remove svg { width: 15px; height: 15px; }

.qb-dialog.is-busy .qb-opt, .qb-dialog.is-busy .qb-remove { opacity: .55; cursor: progress; }

/* while the reader's current list is being fetched: the six lists (and the remove row) are skeleton blocks of the
   same size — no colour, icon or label until the answer says which one is ticked */
.qb-dialog.is-loading .qb-opt,
.qb-dialog.is-loading .qb-opt.is-on { opacity: 1; border-color: rgb(var(--c-white) / .05); background: rgb(var(--c-white) / .03); cursor: default; pointer-events: none; }
.qb-dialog.is-loading .qb-ico,
.qb-dialog.is-loading .qb-label,
.qb-dialog.is-loading .qb-remove { background: rgb(var(--c-white) / .09); animation: qb-skel 1.1s ease-in-out infinite alternate; }
.qb-dialog.is-loading .qb-ico svg,
.qb-dialog.is-loading .qb-check,
.qb-dialog.is-loading .qb-remove > * { visibility: hidden; }
.qb-dialog.is-loading .qb-opt.is-on .qb-check { display: none; }
.qb-dialog.is-loading .qb-label { flex: 0 1 auto; width: 62%; height: 10px; border-radius: 9999px; color: transparent; }
.qb-dialog.is-loading .qb-opt:nth-child(3n + 2) .qb-label { width: 78%; }
.qb-dialog.is-loading .qb-opt:nth-child(3n) .qb-label { width: 48%; }
.qb-dialog.is-loading .qb-opt:nth-child(even) > * { animation-delay: .15s; }
.qb-dialog.is-loading .qb-remove { opacity: 1; cursor: default; pointer-events: none; }
@keyframes qb-skel { from { opacity: .45; } to { opacity: 1; } }

.qb-msg { min-height: 18px; margin: 10px 0 0; font-size: 12px; line-height: 18px; text-align: center; color: rgb(var(--c-white) / calc(var(--ta-b, 0) + var(--ta-m, 1) * .5)); }
.qb-msg:empty { display: none; }
.qb-msg.is-bad { color: rgb(var(--c-red)); }

/* below 768px: the panel as a bottom sheet. quick-bookmark.js hands it to the shared BottomSheet
   (components/bottom-sheet), which lifts it to <body>, places / slides it with inline styles (position, transform,
   bottom padding incl. the safe area), dims the page with its own backdrop and puts its drag handle above the head —
   hence no top padding here. Only the look is ours. One list per row would be too tall: the two columns stay. */
.qb-dialog.qb-sheet {
    width: 100%;
    max-width: 560px;
    margin: 0 auto;
    max-height: 85vh;
    max-height: 85dvh;
    padding: 0 16px;
    border-bottom: 0;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -8px 40px rgb(0 0 0 / .7);
    opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
    .qb-btn, .qb-backdrop, .qb-dialog { transition: none; }
    .qb-dialog.is-loading .qb-ico, .qb-dialog.is-loading .qb-label, .qb-dialog.is-loading .qb-remove { animation: none; }
}
