/* nekud.click Books page (preview). Uses Fieldline tokens so colour themes, dark mode and reader fonts all apply. */
.nk-books { --bk-r: 30px; --bk-r-sm: 18px; --nk-book-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 5.5A2.5 2.5 0 0 1 6.5 3H19v15H6.5A2.5 2.5 0 0 0 4 20.5z'/%3E%3Cpath d='M4 20.5A2.5 2.5 0 0 0 6.5 23H19v-5'/%3E%3C/svg%3E"); }
.nk-books .fl-pagehead { padding-bottom: 8px; }

/* Squircle: Chrome/Edge/Safari with corner-shape get a true superellipse; others fall back to a large smooth radius. */
.nk-squircle { border-radius: var(--bk-r); }
@supports (corner-shape: squircle) {
  .nk-squircle { corner-shape: squircle; border-radius: calc(var(--bk-r) * 1.6); }
  .nk-books { --bk-r-sm: 28px; }
}

/* ---- toolbar ---- */
.nk-toolbar { display: flex; flex-wrap: wrap; gap: 14px 18px; align-items: center; justify-content: space-between; margin: 26px 0 8px; }
.nk-toolbar__l, .nk-toolbar__r { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: center; }
.nk-find { display: flex; align-items: center; gap: 8px; padding: 2px 16px; border: 1px solid var(--fl-rule-strong, var(--fl-rule)); background: var(--fl-surface, #fff); color: var(--fl-muted, #5a5f6e); border-radius: 999px; min-width: min(340px, 100%); }
.nk-find { --bk-r: 999px; }
.nk-find:focus-within { border-color: var(--fl-accent-text, var(--fl-accent)); color: var(--fl-accent-text, var(--fl-accent)); }
.nk-find input { flex: 1; border: 0; outline: 0; background: transparent; color: var(--fl-text, var(--fl-ink)); font: inherit; padding: 10px 0; min-width: 0; }
.nk-find svg { flex: none; }
.nk-count { margin: 0; color: var(--fl-muted, var(--fl-ink-muted)); font-size: .9375rem; }
.nk-sort { display: inline-flex; align-items: center; gap: 8px; font-size: .875rem; color: var(--fl-muted, var(--fl-ink-muted)); }
.nk-sort select { font: inherit; color: var(--fl-text, var(--fl-ink)); background: var(--fl-surface, #fff); border: 1px solid var(--fl-rule-strong, var(--fl-rule)); border-radius: 999px; padding: 8px 14px; }
.nk-books .fl-viewtoggle { display: inline-flex; }
.nk-books .fl-viewtoggle__btn:first-of-type { border-radius: 999px 0 0 999px; padding-left: 16px; }
.nk-books .fl-viewtoggle__btn + .fl-viewtoggle__btn { border-radius: 0 999px 999px 0; padding-right: 16px; }

/* A–Z jump chips */
.nk-az { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 0; padding: 0; list-style: none; }
.nk-az button { min-width: 34px; height: 34px; padding: 0 8px; border-radius: 12px; border: 1px solid var(--fl-rule, #ddd); background: transparent; color: var(--fl-text, var(--fl-ink)); font: inherit; font-size: .8125rem; font-weight: 600; cursor: pointer; }
.nk-az button:hover { background: var(--fl-accent-tint, #eef); }
.nk-az button[aria-pressed="true"] { background: var(--fl-accent); border-color: var(--fl-accent); color: var(--fl-on-accent, #fff); }

/* ---- sync panel ---- */
.nk-sync { margin: 22px 0 0; background: var(--fl-surface, #fff); border: 1px solid var(--fl-rule, #ddd); padding: 18px 22px; display: grid; gap: 14px; }
.nk-sync__row { display: flex; flex-wrap: wrap; gap: 14px 22px; align-items: center; justify-content: space-between; }
.nk-sync__status { display: flex; flex-wrap: wrap; gap: 8px 22px; align-items: center; margin: 0; font-size: .9375rem; color: var(--fl-text, var(--fl-ink)); }
.nk-sync__dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: #2e9b5e; margin-right: 8px; box-shadow: 0 0 0 4px color-mix(in srgb, #2e9b5e 22%, transparent); }
.nk-sync__dot.is-busy { background: var(--fl-ochre, #c2a14a); animation: nkpulse 1s ease-in-out infinite; }
.nk-sync__dot.is-warn { background: #c0682d; box-shadow: 0 0 0 4px color-mix(in srgb, #c0682d 22%, transparent); }
@keyframes nkpulse { 50% { opacity: .35; } }
.nk-sync__status b { font-weight: 700; color: var(--fl-ink); }
.nk-sync__msg { margin: 0; font-size: .875rem; color: var(--fl-muted, var(--fl-ink-muted)); min-height: 1.3em; }
.nk-sync details { border-top: 1px dashed var(--fl-rule, #ddd); padding-top: 12px; }
.nk-sync summary { cursor: pointer; font-weight: 600; font-size: .9375rem; color: var(--fl-accent-text, var(--fl-accent)); }
.nk-sync details p, .nk-sync details li { font-size: .9375rem; line-height: 1.55; color: var(--fl-text, var(--fl-ink)); }
.nk-sync details ol { margin: 10px 0 4px; padding-left: 1.2em; }
.nk-sync code { font-family: var(--fl-mono, monospace); font-size: .85em; background: var(--fl-accent-tint, #eef); padding: 1px 6px; border-radius: 6px; }
.nk-sync .fl-btn { white-space: nowrap; }
.nk-sync .fl-btn svg { width: 16px; height: 16px; }
.nk-sync .fl-btn.is-spinning svg { animation: nkspin .9s linear infinite; }
@keyframes nkspin { to { transform: rotate(360deg); } }

/* ---- shelf ---- */
.nk-shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(var(--nk-tile, 190px), 100%), 1fr)); gap: 22px; margin: 26px 0 70px; padding: 0; list-style: none; }
.nk-book { position: relative; display: flex; flex-direction: column; background: var(--fl-surface, #fff); border: 1px solid var(--fl-rule, #ddd); box-shadow: var(--fl-shadow, none); overflow: hidden; transition: transform .22s cubic-bezier(.2,0,0,1), box-shadow .22s; }
.nk-book:hover, .nk-book:focus-within { transform: translateY(-4px); box-shadow: var(--fl-shadow-lg, 0 14px 34px rgba(0,0,0,.12)); border-color: var(--fl-rule-strong, var(--fl-rule)); }
.nk-book[hidden] { display: none; }
.nk-thumb { --bk-r: 14px; display: flex; align-items: center; justify-content: center; aspect-ratio: 3 / 4; margin: 12px 12px 0; padding: 14px; background: var(--fl-band, var(--fl-paper-deep, #f3f1e6)); overflow: hidden; text-decoration: none; position: relative; }
.nk-thumb img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; border-radius: 6px; box-shadow: 0 6px 16px rgba(20,20,30,.28), 0 1px 3px rgba(20,20,30,.2); transition: transform .3s cubic-bezier(.2,0,0,1); background: #fff; }
.nk-book:hover .nk-thumb img { transform: scale(1.04); }
.nk-thumb:focus-visible { outline: 2px solid var(--fl-accent-text, var(--fl-accent)); outline-offset: 2px; }
.nk-ph { position: absolute; inset: 14px; display: grid; place-content: center; text-align: center; gap: 10px; padding: 16px; border-radius: 8px; color: #fff;
  background: linear-gradient(155deg, color-mix(in srgb, var(--fl-accent) 88%, #000) 0%, color-mix(in srgb, var(--fl-accent-hover, var(--fl-accent)) 65%, var(--fl-iris, #5b6cd1)) 100%);
  box-shadow: 0 6px 16px rgba(20,20,30,.25); }
.nk-ph::before { content: ""; width: 34px; height: 34px; opacity: .6; background: currentColor; -webkit-mask: var(--nk-book-icon) center/contain no-repeat; mask: var(--nk-book-icon) center/contain no-repeat; }
.nk-ph span { font-family: var(--fl-display, Georgia, serif); font-weight: 600; font-size: .95rem; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.nk-ph::after { content: "cover not found"; font-size: .6875rem; letter-spacing: .1em; text-transform: uppercase; opacity: .7; }
.nk-body { padding: 12px 18px 18px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nk-title { margin: 0; font: 700 1rem/1.3 var(--fl-sans); color: var(--fl-ink); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.nk-title a { color: inherit; text-decoration: none; }
.nk-title a:hover { color: var(--fl-accent-text, var(--fl-accent)); text-decoration: underline; text-underline-offset: 3px; }
.nk-author { margin: 0; font-size: .8125rem; color: var(--fl-muted, var(--fl-ink-muted)); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.nk-meta { margin: auto 0 0; padding-top: 8px; display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; font-size: .75rem; color: var(--fl-muted, var(--fl-ink-muted)); }
.nk-meta a { color: var(--fl-accent-text, var(--fl-accent)); font-weight: 600; text-decoration: none; }
.nk-meta a:hover { text-decoration: underline; }
.nk-tag { display: inline-block; padding: 2px 9px; border-radius: 999px; background: var(--fl-accent-tint, #eef); color: var(--fl-accent-text, var(--fl-accent)); font-weight: 600; font-size: .6875rem; letter-spacing: .02em; }
.nk-tag--new { background: var(--fl-mark, #ffebb0); color: var(--fl-ink); }
.nk-empty { text-align: center; padding: 60px 0; color: var(--fl-muted); }

/* ---- list view ---- */
[data-view="list"] .nk-shelf { grid-template-columns: 1fr; gap: 12px; }
[data-view="list"] .nk-book { flex-direction: row; align-items: stretch; }
[data-view="list"] .nk-book:hover { transform: none; }
[data-view="list"] .nk-thumb { aspect-ratio: auto; flex: none; width: 92px; margin: 10px; padding: 8px; }
[data-view="list"] .nk-ph { inset: 8px; padding: 6px; }
[data-view="list"] .nk-ph::before { width: 22px; height: 22px; }
[data-view="list"] .nk-ph span, [data-view="list"] .nk-ph::after { display: none; }
[data-view="list"] .nk-body { justify-content: center; padding: 12px 22px 12px 8px; }
[data-view="list"] .nk-title { font-size: 1.125rem; -webkit-line-clamp: 2; }
[data-view="list"] .nk-meta { margin-top: 6px; }
@media (max-width: 640px) {
  .nk-shelf { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
  .nk-body { padding: 10px 14px 14px; }
  .nk-find { min-width: 100%; }
  [data-view="list"] .nk-thumb { width: 72px; }
  .nk-toolbar__r { width: 100%; justify-content: space-between; }
}
.nk-note { display: none !important; }
.nk-preview-flag { position: fixed; left: 12px; bottom: 12px; z-index: 300; background: #1a1f2e; color: #fff; font: 600 12px/1 var(--fl-sans); letter-spacing: .08em; text-transform: uppercase; padding: 8px 12px; border-radius: 999px; opacity: .85; pointer-events: none; }
@media (prefers-reduced-motion: reduce) { .nk-book, .nk-thumb img { transition: none; } .nk-sync__dot.is-busy, .nk-sync .fl-btn.is-spinning svg { animation: none; } }

.nk-sync[hidden] { display: none !important; }
a.nk-thumb,.nk-thumb--link{cursor:pointer}.nk-thumb--link:hover img{opacity:.88;transform:scale(1.02);transition:transform .15s,opacity .15s}

/* Tile size control (grid only) */
.nk-size { display: inline-flex; align-items: center; gap: 2px; font-size: .875rem; color: var(--fl-muted, var(--fl-ink-muted)); border: 1px solid var(--fl-rule-strong, var(--fl-rule)); border-radius: 999px; padding: 3px; background: var(--fl-surface, #fff); }
.nk-size__label { padding: 0 6px 0 8px; }
.nk-size { padding: 4px 12px 4px 4px; gap: 8px; }
.nk-size__range { -webkit-appearance: none; appearance: none; width: 130px; height: 4px; border-radius: 999px; margin: 0; cursor: pointer; background: linear-gradient(to right, var(--fl-text, var(--fl-ink)) var(--nk-fill, 35%), var(--fl-rule-strong, var(--fl-rule, #ccc)) var(--nk-fill, 35%)); }
.nk-size__range::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: var(--fl-text, var(--fl-ink)); border: 2px solid var(--fl-surface, #fff); box-shadow: 0 0 0 1px var(--fl-rule-strong, var(--fl-rule)); }
.nk-size__range::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--fl-text, var(--fl-ink)); border: 2px solid var(--fl-surface, #fff); }
.nk-size__range:focus-visible { outline: 2px solid currentColor; outline-offset: 4px; }
[data-view="list"] .nk-size { display: none; }
@media (max-width: 640px) {
  .nk-shelf { grid-template-columns: repeat(auto-fill, minmax(min(calc(var(--nk-tile, 190px) * .72), 100%), 1fr)); }
}
/* v1.4: squircle cover frames — no sharp corners anywhere */
.nk-book { border-radius: 28px; }
.nk-book .nk-thumb { border-radius: 20px; }
.nk-book .nk-thumb img, .nk-book .nk-ph { border-radius: 12px; }
@supports (corner-shape: squircle) {
  .nk-book { corner-shape: squircle; border-radius: 44px; }
  .nk-book .nk-thumb { corner-shape: squircle; border-radius: 32px; }
  .nk-book .nk-thumb img, .nk-book .nk-ph { corner-shape: squircle; border-radius: 20px; }
}
/* v1.4: covers fit fully inside the soft frame — no hard cuts */
.nk-book .nk-thumb { box-sizing: border-box; padding: 18px; overflow: hidden; clip-path: none; }
.nk-book .nk-thumb img { display: block; max-width: 100%; max-height: 100%; min-width: 0; min-height: 0; object-fit: contain; }
.nk-book:hover .nk-thumb img { transform: scale(1.02); }
/* v1.5: inset the blue band so it doesn't sit flush against the card border */
.nk-book .nk-thumb { margin: 20px 20px 0; }
.nk-book:only-child .nk-thumb, .nk-book .nk-thumb:last-child { margin-bottom: 20px; }
@media (max-width: 640px) { .nk-book .nk-thumb { margin: 14px 14px 0; } .nk-book .nk-thumb:last-child { margin-bottom: 14px; } }
/* 1.6 source filter */
.nk-source select { min-width: 7.5em; }

.nk-category select { min-width: 10.5em; }
