/* ?view=cards: the three.js card ring (cards/cards.js).
   Ported from com/gallery/style.css (view-cards section), on the slideshow's theme
   variables; the text keeps the host's font. */

html[data-view="cards"] .container {
    position: relative;
    display: block;
    width: 100%;
    height: 100vh;
}

#cards-canvas {
    display: block;
    width: 100%;
    height: 100%;
    touch-action: none; /* drag is handled in cards.js */
    cursor: grab;
    opacity: 0;
    transition: opacity 1.2s ease;
}

#cards-canvas.ready {
    opacity: 1;
}

#cards-canvas.dragging {
    cursor: grabbing;
}

#cards-canvas.pointing {
    cursor: pointer;
}

/* Arc labels (years), positioned every frame from the projected arc midpoint */
#arc-labels {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 3;
}

.arc-label {
    position: absolute;
    transform: translate(-50%, -50%);
    font-size: 14px;
    letter-spacing: 0.08em;
    color: var(--notion-text-muted);
    white-space: nowrap;
    transition: opacity 0.3s ease;
}

/* Centre preview, shown while a card is hovered */
#preview {
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.35s ease;
    z-index: 5;
}

#preview.visible {
    opacity: 1;
}

/* The ring's centre projects slightly above the viewport centre */
#preview .slide-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -54%);
    display: flex;
    justify-content: center;
    align-items: center;
    max-width: 90%;
    padding: 0;
}

#preview img,
#preview video {
    max-height: 40vh;
    max-width: 44vw;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: var(--notion-radius-xl, 8px);
    box-shadow: 0 8px 32px var(--slide-hover-shadow);
}

/* Linked card: the glow the slideshow shows on hover */
#preview .slide-content.has-link img,
#preview .slide-content.has-link video {
    box-shadow: 0 8px 32px var(--slide-hover-shadow), 0 0 20px var(--slideshow-glow, var(--notion-accent));
}

/* Caption in the empty band below the ring; its links stay clickable */
#preview .slide-caption {
    position: absolute;
    bottom: 38px;
    left: 0;
    width: 100%;
    box-sizing: border-box;
    font-size: 14px;
    color: var(--notion-text-muted);
    pointer-events: auto;
}

.cards-hint {
    position: absolute;
    bottom: 14px;
    left: 0;
    width: 100%;
    text-align: center;
    font-size: 11px;
    color: var(--notion-text-muted);
    opacity: 0.5;
    pointer-events: none;
    z-index: 3;
    transition: opacity 0.5s ease;
}

.cards-hint.hidden {
    opacity: 0;
}

@media (max-width: 768px) {
    #preview img,
    #preview video {
        max-height: 32vh;
        max-width: 72vw;
    }

    #preview .slide-caption {
        font-size: 11px;
    }
}
