/* Locked-chapter dialog (assets/scripts/chapter-lock.js): opens when a locked chapter is clicked in a list.
   Colours are the site tokens + the viewer's zmio-synced accent (--zmio-accent-*), then the colour scheme's, then
   violet. The radius level and the plain-border option reach it through ui-radius.css / ui-plain.css. */
.cl-modal, .cl-modal * { box-sizing: border-box; }
html.cl-open { overflow: hidden; }

.cl-modal { position: fixed; inset: 0; z-index: 10000; display: flex; align-items: center; justify-content: center; padding: 16px; }
.cl-modal[hidden] { display: none; }
.cl-backdrop { position: absolute; inset: 0; background: rgb(0 0 0 / .65); opacity: 0; transition: opacity .18s ease; }
.cl-dialog {
    position: relative;
    width: 100%;
    max-width: 420px;
    max-height: calc(100vh - 32px);
    max-height: calc(100dvh - 32px);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 22px;
    border-radius: 1.25rem;
    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;
}
.cl-modal.is-open .cl-backdrop { opacity: 1; }
.cl-modal.is-open .cl-dialog { opacity: 1; transform: none; }

.cl-x { position: absolute; top: 12px; right: 12px; 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; }
.cl-x:hover { color: rgb(var(--c-white)); background: rgb(var(--c-white) / .06); }
.cl-x svg { width: 18px; height: 18px; }

/* cover + series / chapter / when it turns free */
.cl-head { display: flex; align-items: center; gap: 14px; margin: 18px 0 18px; }
.cl-cover { flex: none; width: 64px; height: 72px; border-radius: .5rem; overflow: hidden; background: rgb(var(--c-white) / .06); }
.cl-cover[hidden] { display: none; }
.cl-cover img { display: block; width: 100%; height: 100%; max-width: none; object-fit: cover; }
.cl-head-text { flex: 1 1 auto; min-width: 0; }
.cl-series { margin: 0; font-size: 13px; line-height: 1.35; color: rgb(var(--c-white) / calc(var(--ta-b, 0) + var(--ta-m, 1) * .55)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cl-series[hidden] { display: none; }
.cl-title { margin: 2px 0 0; font-size: 19px; line-height: 1.25; font-weight: 800; color: rgb(var(--c-white)); display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cl-note { margin: 4px 0 0; font-size: 13px; line-height: 1.4; color: rgb(var(--c-white) / calc(var(--ta-b, 0) + var(--ta-m, 1) * .55)); }

/* the price panel: one line per fact (price, the reader's coins, the subscription tier) */
.cl-facts { padding: 0 14px; border: 1px solid rgb(var(--c-white) / .06); border-radius: .75rem; background: rgb(var(--c-white) / .05); }
.cl-fact { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 46px; font-size: 14px; }
.cl-fact + .cl-fact { border-top: 1px solid rgb(var(--c-white) / .06); }
.cl-fact-k { min-width: 0; color: rgb(var(--c-white) / calc(var(--ta-b, 0) + var(--ta-m, 1) * .5)); }
.cl-fact-v { flex: none; display: inline-flex; align-items: center; gap: 6px; font-weight: 700; color: rgb(var(--c-white)); font-variant-numeric: tabular-nums; }
.cl-fact-v.is-accent { color: var(--zmio-accent-light, rgb(var(--c-violet-soft))); }
.cl-fact-v svg { flex: none; width: 16px; height: 16px; }

.cl-hint { margin: 14px 0 0; font-size: 13px; line-height: 1.45; text-align: center; color: rgb(var(--c-white) / calc(var(--ta-b, 0) + var(--ta-m, 1) * .6)); }
.cl-hint:empty { display: none; }

/* buttons: two side by side, a lone one fills the row, .is-wide takes a row of its own */
.cl-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.cl-btn {
    flex: 1 1 calc(50% - 4px);
    min-width: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 8px 16px;
    border: 1px solid rgb(var(--c-white) / .12);
    border-radius: .75rem;
    background: rgb(var(--c-white) / .05);
    color: rgb(var(--c-white) / calc(var(--ta-b, 0) + var(--ta-m, 1) * .85));
    font: inherit;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease, filter .15s ease, opacity .15s ease;
}
.cl-btn:hover { background: rgb(var(--c-white) / .1); color: rgb(var(--c-white)); }
.cl-btn.is-wide { flex-basis: 100%; }
.cl-btn.is-primary { border-color: transparent; background: var(--zmio-accent-pill-bg, var(--scheme-pill, linear-gradient(135deg, rgb(109, 40, 217), rgb(167, 139, 250)))); background-origin: border-box; color: #fff; } /* border-box: or the gradient's far end tiles in under the left border as a line */
.cl-btn.is-primary:hover { background: var(--zmio-accent-pill-bg, var(--scheme-pill, linear-gradient(135deg, rgb(109, 40, 217), rgb(167, 139, 250)))); background-origin: border-box; color: #fff; filter: brightness(1.1); }
.cl-btn:disabled { opacity: .6; cursor: progress; filter: none; }
.cl-btn svg { flex: none; width: 16px; height: 16px; }
.cl-btn:focus-visible, .cl-x:focus-visible { outline: 2px solid var(--zmio-accent-soft, #a78bfa); outline-offset: 2px; }

.cl-spin { flex: none; width: 15px; height: 15px; border: 2px solid rgb(255 255 255 / .35); border-top-color: #fff; border-radius: 50%; animation: cl-spin .6s linear infinite; }
@keyframes cl-spin { to { transform: rotate(360deg); } }

/* while the live price / balance is on its way: blocks the size of what will be there */
.cl-skel { display: block; border-radius: .75rem; background: rgb(var(--c-white) / .09); animation: cl-skel 1.1s ease-in-out infinite alternate; }
.cl-skel-btn { flex: 1 1 calc(50% - 4px); height: 44px; }
.cl-skel-btn + .cl-skel-btn { animation-delay: .15s; }
.cl-skel-val { width: 56px; height: 12px; border-radius: 9999px; }
@keyframes cl-skel { from { opacity: .45; } to { opacity: 1; } }

.cl-msg { 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)); }
.cl-msg:empty { display: none; }
.cl-msg.is-bad { color: rgb(var(--c-red)); }

/* phones: a sheet at the foot of the screen */
@media (max-width: 639.98px) {
    .cl-modal { align-items: flex-end; padding: 0; }
    .cl-dialog { max-width: none; max-height: 88vh; max-height: 88dvh; padding: 20px 16px calc(env(safe-area-inset-bottom, 0px) + 16px); border-radius: 20px 20px 0 0; border-bottom: 0; transform: translateY(24px); }
}

@media (prefers-reduced-motion: reduce) {
    .cl-backdrop, .cl-dialog { transition: none; }
    .cl-skel { animation: none; }
}
