/* ─────────────────────────────────────────────────────────
   Circular Gallery Plugin v2.0 — CSS
   ───────────────────────────────────────────────────────── */

/* ── Section ── */
.cg-section {
    width: 100%;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 80px 20px;
    box-sizing: border-box;
    background-color: #f5f4f0;
}

/* ── Stage ── */
.cg-stage {
    position: relative;
    width:  calc(var(--cg-radius, 22em) * 2 + var(--cg-size, 180px) * 1.4);
    height: calc(var(--cg-radius, 22em) * 2 + var(--cg-size, 180px) * 1.4);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ── Orbit ring — before intro: controlled by JS inline styles ── */
.cg-orbit-ring {
    position: absolute;
    inset: 0;
    opacity: 0; /* JS sets initial state */
}

/* ── After intro: CSS keyframe rotation ── */
.cg-orbit-ring.cg-spinning {
    opacity: 1 !important;
    animation: cg-spin var(--cg-speed, 30s) linear infinite;
    animation-direction: var(--cg-direction, normal);
    transform-origin: center center;
}

@keyframes cg-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* ── Orbit item: positioned at each angle around the radius ── */
.cg-orbit-item {
    position: absolute;
    top:  50%;
    left: 50%;
    width:  var(--cg-size, 180px);
    height: var(--cg-size, 180px);
    margin-top:  calc(var(--cg-size, 180px) / -2);
    margin-left: calc(var(--cg-size, 180px) / -2);
    transform:
        rotate(var(--cg-angle, 0deg))
        translateY(calc(-1 * var(--cg-radius, 22em)))
        rotate(calc(-1 * var(--cg-angle, 0deg)));
}

/* ── Card ── */
.cg-card {
    width:  100%;
    height: 100%;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 6px 24px rgba(0,0,0,.15);
    transform-origin: center center;
    position: relative;
    /* Counter-rotate — only when ring is spinning */
    animation: cg-counter-spin var(--cg-speed, 30s) linear infinite;
    animation-direction: var(--cg-counter-dir, reverse); /* opposite of ring */
    animation-play-state: paused; /* paused until .cg-spinning */
}

.cg-orbit-ring.cg-spinning .cg-card {
    animation-play-state: running;
}

@keyframes cg-counter-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* Hover lift effect on individual card */
.cg-card::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    box-shadow: 0 0 0 0 rgba(0,0,0,0);
    transition: box-shadow 0.3s ease;
}
.cg-card:hover::after {
    box-shadow: 0 14px 40px rgba(0,0,0,.25);
}

.cg-card img {
    width:  100%;
    height: 100%;
    object-fit: cover;
    display: block;
    pointer-events: none;
    user-select: none;
    -webkit-user-drag: none;
}

/* ── Pause on hover (whole stage) ── */
.cg-pause-hover:hover .cg-orbit-ring.cg-spinning {
    animation-play-state: paused;
}
.cg-pause-hover:hover .cg-card {
    animation-play-state: paused;
}

/* ── CTA centre ── */
.cg-cta {
    position: relative;
    z-index: 5;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    text-decoration: none;
    color: inherit;
    text-align: center;
    padding: 20px;
    max-width: 600px;
}

.cg-cta-text {
    margin: 0;
    font-size: clamp(1.6rem, 3.5vw, 2.8rem);
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.02em;
    color: #111;
    transition: opacity 0.2s ease;
}

.cg-cta:hover .cg-cta-text {
    opacity: 0.6;
}

.cg-arrow {
    width: 38px;
    height: 38px;
    color: #111;
    transition: transform 0.25s ease, opacity 0.2s ease;
    flex-shrink: 0;
}

.cg-cta:hover .cg-arrow {
    transform: translateX(7px);
    opacity: 0.6;
}

/* ── Responsive ── */
@media (max-width: 1100px) {
    .cg-stage {
        --cg-radius: 15em;
        --cg-size: 145px;
    }
}
@media (max-width: 768px) {
    .cg-stage {
        --cg-radius: 11em;
        --cg-size: 112px;
    }
    .cg-cta-text { font-size: 1.5rem; }
}
@media (max-width: 480px) {
    .cg-stage {
        --cg-radius: 8em;
        --cg-size: 88px;
    }
    .cg-cta-text { font-size: 1.25rem; }
    .cg-section { padding: 50px 16px; }
}
