.arc-carousel-wrap {
    font-family: sans-serif;
    max-width: 100%;
    margin: 1.5rem 0;
    --arc-card-w: 160px; /* default; overridden inline by JS */
}

.arc-carousel-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 12px;
    color: #1c1c1c;
}

/* ── Cold-path loading bar ───────────────────────────────────────────────
   Shown below the title while JS is still fetching metadata from
   archive.org.  Fades out automatically once all items are resolved.     */
.arc-loading-bar-wrap {
    height: 3px;
    background: #f0f0f0;
    border-radius: 2px;
    margin: -8px 0 10px;
    overflow: hidden;
    opacity: 1;
    transition: opacity 0.5s ease 0.3s;
}
.arc-loading-bar-wrap.arc-loading-done {
    opacity: 0;
}
.arc-loading-bar {
    height: 100%;
    background: linear-gradient(90deg, #bbb 0%, #555 50%, #bbb 100%);
    background-size: 200% 100%;
    border-radius: 2px;
    animation: arc-bar-sweep 1.4s linear infinite;
    transition: width 0.4s ease;
}
@keyframes arc-bar-sweep {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.arc-shell {
    position: relative;
    border: 1px solid #e2e2e2;
    border-radius: 6px;
    overflow: visible;
    background: #fff;

}

.arc-vp {
    overflow: hidden;
    border-radius: 6px;
}

.arc-track {
    display: flex;
    transition: transform 0.38s cubic-bezier(0.4, 0, 0.2, 1);
}

.arc-item {
    flex: 0 0 var(--arc-card-w);
    min-width: var(--arc-card-w);
    box-sizing: border-box;   /* border is inside cardWidth — translation math stays exact */
    padding: 14px 10px;
    border-right: 1px solid #e2e2e2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 7px;
    text-decoration: none;
    background: #fff;
    cursor: pointer;
    transition: background 0.12s;
}

.arc-item:last-child {
    border-right: none;
}

.arc-item:hover {
    background: #f8f7f4;
}

.arc-item img {
    width: calc(var(--arc-card-w) * 0.5625);   /* 90/160 = 56% of card width */
    height: calc(var(--arc-card-w) * 0.78125);  /* 125/160 = 78% — book cover ratio */
    object-fit: cover;
    border-radius: 3px;
    border: 1px solid #eee;
    background: #f5f5f5;
    display: block;
}

.arc-item-title {
    font-size: 11px;
    color: #1c1c1c;
    text-align: center;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    max-height: 4.2em;
}

.arc-item-title-in {
    font-size: 10px;
    color: #999;
    font-style: italic;
    font-weight: normal;
}

.arc-item-title-archive {
    font-size: 10px;
    color: #999;
    font-weight: normal;
}

.arc-item-year {
    font-size: 10px;
    color: #999;
}

.arc-item-addeddate {
    font-size: 9px;
    color: #bbb;
    letter-spacing: 0.02em;
}

.arc-list-addeddate {
    font-size: 11px;
    color: #bbb;
}

.arc-item-author {
    font-size: 10px;
    color: #555;
    font-style: italic;
    text-align: center;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    max-width: 100%;
}

.arc-item-lang {
    font-size: 9px;
    color: #aaa;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.arc-item-desc {
    font-size: 10px;
    color: #777;
    text-align: center;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    max-height: 4.2em;
}

.arc-item-cta {
    font-size: 10px;
    margin-top: auto;
}

.arc-arr {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 38px;
    height: 38px;
    /* Dark fill with white arrow — visible against any card colour */
    background: rgba(28, 28, 28, 0.55);
    color: #fff;
    border: 2px solid rgba(255,255,255,0.7);
    backdrop-filter: blur(2px);
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    /* Shadow ensures separation from both white cards and coloured covers */
    box-shadow: 0 2px 8px rgba(0,0,0,0.35), 0 0 0 1px rgba(0,0,0,0.08);
    transition: background 0.15s, transform 0.15s, box-shadow 0.15s;
    line-height: 1;
    padding: 0;
    user-select: none;
}

.arc-arr:hover:not(:disabled) {
    background: #c0392b;
    border-color: #fff;
    box-shadow: 0 4px 14px rgba(0,0,0,0.4), 0 0 0 1px rgba(0,0,0,0.08);
    transform: translateY(-50%) scale(1.1);
}

.arc-arr:active:not(:disabled) {
    transform: translateY(-50%) scale(0.96);
}

.arc-arr:disabled {
    opacity: 0.25;
    cursor: default;
    box-shadow: none;
}

/* Arrows sit inside the viewport, inset from the edges */
.arc-arr-l { left: 6px; }
.arc-arr-r { right: 6px; }

.arc-dots {
    display: flex;
    justify-content: center;
    gap: 5px;
    padding: 9px 0 3px;
    flex-wrap: wrap;
}

.arc-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #e2e2e2;
    border: none;
    cursor: pointer;
    padding: 0;
    transition: background 0.15s;
}

.arc-dot.arc-on {
    background: #1c1c1c;
}


/* ── Fetch status indicator ──────────────────────────────────────────────────
   Appears below the loading bar after all initial fetches complete.
   'ok'   = all items loaded (green, auto-fades after 4 s)
   'warn' = some items failed or are retrying (amber, stays until resolved)
   'retry'= transient "retrying…" state                                     */
.arc-fetch-status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-family: sans-serif;
    padding: 3px 10px 3px 8px;
    border-radius: 3px;
    margin: 2px 0 8px;
    line-height: 1.4;
    transition: opacity 0.8s ease;
}
.arc-fetch-ok {
    color: #1b5e20;
    background: #e8f5e9;
    border: 1px solid #a5d6a7;
}
.arc-fetch-warn {
    color: #7a4000;
    background: #fff8e1;
    border: 1px solid #ffe082;
}
.arc-fetch-retry {
    color: #0d47a1;
    background: #e3f2fd;
    border: 1px solid #90caf9;
}
.arc-fetch-icon {
    font-size: 12px;
    flex-shrink: 0;
}

.arc-loading {
    padding: 2.5rem;
    text-align: center;
    font-size: 13px;
    color: #999;
    font-style: italic;
}

.arc-error {
    padding: 1.5rem;
    text-align: center;
    font-size: 13px;
    color: #c0392b;
    font-style: italic;
}

/* Responsive: handled automatically via --arc-card-w */

.arc-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
    flex-wrap: wrap;
}

.arc-search {
    flex: 1;
    min-width: 120px;
    flex: 1;
    padding: 7px 12px;
    font-size: 13px;
    border: 1px solid #ddd;
    border-radius: 20px;
    outline: none;
    background: #fafafa;
    color: #1c1c1c;
    transition: border-color 0.15s, box-shadow 0.15s;
    min-width: 0;
}

.arc-search:focus {
    border-color: #aaa;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(0,0,0,0.06);
}

.arc-search-count-wrap {
    min-height: 18px;
    margin-bottom: 8px;
}

.arc-search-count {
    font-size: 11px;
    color: #999;
    white-space: nowrap;
}

.arc-limit-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    color: #5a3e00;
    background: #fff3cd;
    border: 1px solid #f0c040;
    border-radius: 4px;
    padding: 2px 8px;
    margin-left: 10px;
    white-space: nowrap;
    vertical-align: middle;
    letter-spacing: 0.01em;
}

.arc-sort {
    padding: 7px 28px 7px 12px;
    font-size: 13px;
    border: 1px solid #ddd;
    border-radius: 20px;
    outline: none;
    background: #fafafa url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23888'/%3E%3C/svg%3E") no-repeat right 10px center;
    -webkit-appearance: none;
    appearance: none;
    color: #1c1c1c;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
    white-space: nowrap;
}

.arc-sort:focus {
    border-color: #aaa;
    background-color: #fff;
    box-shadow: 0 0 0 3px rgba(0,0,0,0.06);
}

.arc-item-count {
    font-size: 13px;
    font-weight: 400;
    color: #999;
    margin-left: 6px;
}

/* Invalid URL placeholder card */
.arc-item-invalid {
    opacity: 0.65;
    border: 2px dashed #e0c070;
    background: #fffdf0;
    justify-content: center;
}
.arc-item-invalid:hover {
    background: #fffdf0;
}
.arc-item-placeholder-icon {
    font-size: 28px;
    line-height: 1;
    color: #c8a020;
}
.arc-item-placeholder-label {
    font-size: 11px;
    font-weight: 600;
    color: #a07010;
    text-align: center;
}
.arc-item-placeholder-url {
    font-size: 9px;
    color: #aaa;
    text-align: center;
    word-break: break-all;
    max-height: 2.8em;
    overflow: hidden;
    font-family: monospace;
}

/* ================================================================
   VIEW TOGGLE BUTTONS
   ================================================================ */
.arc-view-btns {
    display: flex;
    gap: 3px;
    margin-left: auto;
    flex-shrink: 0;
}

.arc-view-btn {
    width: 32px;
    height: 32px;
    border: 1px solid #ddd;
    background: #fafafa;
    border-radius: 5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    color: #aaa;
    transition: background 0.12s, color 0.12s, border-color 0.12s;
    padding: 0;
    line-height: 1;
}

.arc-view-btn:hover {
    background: #f0f0f0;
    color: #555;
    border-color: #bbb;
}

.arc-view-btn.arc-view-btn-active {
    background: #1c1c1c;
    color: #fff;
    border-color: #1c1c1c;
}

/* ================================================================
   LIST VIEW
   ================================================================ */
.arc-list-wrap {
    border: 1px solid #e2e2e2;
    border-radius: 6px;
    overflow-y: auto;
    max-height: 500px;   /* default; overridden per-shortcode via JS */
    background: #fff;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #ccc transparent;
}

.arc-list-wrap::-webkit-scrollbar {
    width: 5px;
}
.arc-list-wrap::-webkit-scrollbar-track {
    background: transparent;
}
.arc-list-wrap::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}
.arc-list-wrap::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}

.arc-list-item {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 14px 16px;
    border-bottom: 1px solid #f0f0f0;
    text-decoration: none;
    color: inherit;
    background: #fff;
    transition: background 0.12s;
    cursor: pointer;
}

.arc-list-item:last-child {
    border-bottom: none;
}

.arc-list-item:hover {
    background: #f8f7f4;
}

/* odd/even row tint */
.arc-list-item:nth-child(even) {
    background: #fdfdfd;
}

.arc-list-item:nth-child(even):hover {
    background: #f5f4f1;
}

.arc-list-cover {
    flex-shrink: 0;
    width: 68px;
}

.arc-list-cover img {
    width: 68px;
    height: 96px;
    object-fit: cover;
    border-radius: 3px;
    border: 1px solid #e8e8e8;
    background: #f5f5f5;
    display: block;
    box-shadow: 0 1px 4px rgba(0,0,0,0.10);
}

.arc-list-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding-top: 2px;
}

.arc-list-title {
    font-size: 15px;
    font-weight: 600;
    color: #1c1c1c;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.arc-list-subtitle {
    font-size: 12px;
    color: #aaa;
    font-style: italic;
    line-height: 1.3;
}

.arc-list-author {
    font-size: 13px;
    color: #555;
    font-style: italic;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.arc-list-meta-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 12px;
    color: #aaa;
}

.arc-list-lang {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: #f0f0f0;
    color: #888;
    padding: 1px 6px;
    border-radius: 3px;
}

.arc-list-desc {
    font-size: 13px;
    color: #666;
    line-height: 1.55;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-top: 1px;
}

.arc-list-cta {
    font-size: 12px;
    font-weight: 500;
    margin-top: 2px;
}

/* Invalid placeholder in list view */
.arc-list-item.arc-item-invalid {
    opacity: 0.65;
    border: 2px dashed #e0c070;
    background: #fffdf0;
    align-items: center;
}

.arc-list-item.arc-item-invalid:hover {
    background: #fffdf0;
}

/* ================================================================
   SIZE SLIDER
   ================================================================ */
.arc-size-slider-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    margin-left: auto;
}

/* When both view-toggle and size-slider are present, don't double-push */
.arc-view-btns + .arc-size-slider-wrap {
    margin-left: 4px;
}

.arc-size-slider-icon {
    font-size: 13px;
    color: #aaa;
    user-select: none;
    line-height: 1;
}

.arc-size-slider {
    width: 80px;
    height: 4px;
    accent-color: #1c1c1c;
    cursor: pointer;
    /* Cross-browser track reset */
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    padding: 0;
    margin: 0;
}

/* Track */
.arc-size-slider::-webkit-slider-runnable-track {
    height: 4px;
    border-radius: 2px;
    background: #e2e2e2;
}
.arc-size-slider::-moz-range-track {
    height: 4px;
    border-radius: 2px;
    background: #e2e2e2;
}

/* Thumb */
.arc-size-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #1c1c1c;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px #ccc;
    margin-top: -5px;
    cursor: pointer;
    transition: background 0.15s, box-shadow 0.15s;
}
.arc-size-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #1c1c1c;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px #ccc;
    cursor: pointer;
    transition: background 0.15s, box-shadow 0.15s;
}

.arc-size-slider:hover::-webkit-slider-thumb {
    background: #444;
    box-shadow: 0 0 0 3px rgba(0,0,0,0.12);
}
.arc-size-slider:hover::-moz-range-thumb {
    background: #444;
    box-shadow: 0 0 0 3px rgba(0,0,0,0.12);
}

/* ================================================================
   MOBILE TOOLBAR — controls stack into two tidy rows
   ================================================================ */
@media (max-width: 480px) {

    .arc-toolbar {
        gap: 6px;
    }

    /* Search fills its own full row */
    .arc-search {
        width: 100%;
        flex: 1 1 100%;
        order: 1;
    }

    /* Sort fills its own full row */
    .arc-sort {
        width: 100%;
        flex: 1 1 100%;
        box-sizing: border-box;
        order: 2;
    }

    /* View-toggle + size-slider share a row, pushed to the right */
    .arc-view-btns {
        order: 3;
        margin-left: auto;
    }

    .arc-size-slider-wrap {
        order: 4;
        margin-left: 0;
    }

    /* When only the icon controls are present (no search/sort),
       keep them on a single row without orphaning */
    .arc-toolbar > .arc-view-btns:first-child {
        margin-left: auto;
    }
}

/* ── Frontend refresh button (lives in .arc-toolbar row) ───────────────── */
.arc-fe-refresh {
    margin-left:     auto;   /* push to the far right of the toolbar */
    padding:         0;
    border:          1px solid rgba(0,0,0,.18);
    border-radius:   50%;
    background:      transparent;
    color:           #777;
    font-size:       15px;
    line-height:     1;
    cursor:          pointer;
    transition:      color .15s, background .15s, transform .2s;
    width:           28px;
    height:          28px;
    flex-shrink:     0;
    display:         flex;
    align-items:     center;
    justify-content: center;
}
.arc-fe-refresh:hover:not(:disabled) {
    background: rgba(0,0,0,.06);
    color:      #222;
}
/* Spinning animation while busy */
.arc-fe-refresh-busy {
    animation: arc-spin 1s linear infinite;
    cursor:    wait;
}
@keyframes arc-spin {
    from { transform: rotate(0deg);   }
    to   { transform: rotate(360deg); }
}
