/* ==============================================
   Countdown — Circular Rings with Carded Items + Outer Frame
   - Responsive wrapping, pulse animation, theme-safe colors
   - Cleaned up; duplicates removed
================================================= */
:root {
    --ring-size: clamp(96px, 22vw, 140px);
    --ring-stroke: 12;
    --cc-pad: 12px;
    --ring-inner: calc(var(--ring-size) - 2 * var(--cc-pad));
}

/* Outer framed container */
.countdown-circles {
    max-width: 700px;
    margin: 20px auto;
    text-align: center;
    background: var(--card-bg, var(--brand-50));
    border: 1px solid var(--brand-border);
    border-radius: var(--radius, 12px);
    padding: 16px;
    box-shadow: var(--card-shadow, 0 6px 18px rgba(0,0,0,.12));
    font-family: system-ui, Arial;
}

.cc-title {
    font-size: 1.6rem;
    margin-bottom: 12px;
    color: var(--brand-600);
}

/* Grid wraps automatically */
.cc-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fit, minmax(var(--ring-size), 1fr));
    align-items: start;
    margin-top: 8px;
}

/* Carded item */
.cc-item {
    background: var(--surface);
    border: 1px dashed var(--brand-border);
    border-radius: var(--radius);
    padding: var(--cc-pad);
    box-shadow: var(--card-shadow);
    display: grid;
    grid-template-rows: 1fr auto;
    justify-items: center;
    align-items: center;
    overflow: hidden;
}

/* Stack wrapper for the ring + value */
.cc-stack {
    position: relative;
    width: var(--ring-inner);
    height: var(--ring-inner);
    display: grid;
    place-items: center;
}

/* Fallback overlap if no .cc-stack */
.cc-item > svg, .cc-item .cc-val {
    grid-area: 1 / 1;
}

/* SVG ring */
.cc-item svg {
    transform: rotate(-90deg);
    width: var(--ring-inner);
    height: var(--ring-inner);
}

.cc-item .bg {
    fill: none;
    stroke: var(--brand-100);
    stroke-width: var(--ring-stroke);
}

.cc-item .fg {
    fill: none;
    stroke: var(--brand);
    stroke-width: var(--ring-stroke);
    stroke-linecap: round;
    stroke-dasharray: 339.292; /* circumference for r=54 */
    stroke-dashoffset: 339.292;
    transition: stroke-dashoffset .35s ease;
}

/* Value & label */
.cc-val {
    font-size: clamp(1.2rem, 4.2vw, 1.8rem);
    font-weight: 800;
    color: var(--brand-ink);
    line-height: 1;
    pointer-events: none;
}

.cc-label {
    align-self: end;
    margin-top: 4px;
    margin-bottom: 2px;
    font-size: .85rem;
    font-weight: 600;
    color: var(--brand-ink);
    text-transform: uppercase;
}

/* Pulse animations */
.cc-item.pulse .fg {
    animation: ringPulse 600ms ease;
}

.cc-item.pulse .cc-val {
    animation: numPop 600ms ease;
}

@keyframes ringPulse {
    0% {
        filter: none;
        stroke: var(--brand);
    }

    40% {
        filter: drop-shadow(0 0 8px var(--focus-ring));
        stroke: var(--brand-600);
    }

    100% {
        filter: none;
        stroke: var(--brand);
    }
}

@keyframes numPop {
    0% {
        transform: scale(1);
        color: var(--brand-ink);
    }

    40% {
        transform: scale(1.08);
        color: var(--brand-600);
    }

    100% {
        transform: scale(1);
        color: var(--brand-ink);
    }
}

@media (prefers-reduced-motion: reduce) {
    .cc-item.pulse .fg, .cc-item.pulse .cc-val {
        animation: none !important;
    }
}

/* ===== Optional prettier color treatments ===== */
.cc-theme-soft .cc-item {
    background: linear-gradient( 180deg, color-mix(in srgb, var(--brand-50) 85%, transparent), color-mix(in srgb, var(--brand-50) 60%, transparent) );
}

    .cc-theme-soft .cc-item .bg {
        stroke: color-mix(in srgb, var(--brand-100) 70%, transparent);
    }

    .cc-theme-soft .cc-item .fg {
        filter: drop-shadow(0 0 4px color-mix(in srgb, var(--brand) 25%, transparent));
    }

.cc-theme-glass .cc-item {
    background: color-mix(in srgb, var(--surface) 60%, transparent);
    border: 1px solid color-mix(in srgb, var(--brand-border) 70%, transparent);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
}

.cc-theme-vivid .cc-item {
    background: linear-gradient(180deg, var(--brand-100), var(--brand-50));
    border: 1px solid color-mix(in srgb, var(--brand) 30%, transparent);
}

/* ==============================================
   Celebration overlay (used by both widgets)
================================================= */
.celebrate-pane {
    position: relative;
    overflow: hidden;
    background: linear-gradient(180deg, var(--brand-100), var(--brand-50));
    border: 1px solid var(--brand-border);
    border-radius: var(--radius, 12px);
    box-shadow: var(--card-shadow, 0 6px 18px rgba(0,0,0,.12));
    padding: 24px 16px;
    display: grid;
    gap: 10px;
    place-items: center;
    min-height: 220px;
}

.celebrate-title {
    position: relative;
    z-index: 1;
    font: 800 clamp(1.2rem, 4vw, 2rem)/1 system-ui, Arial;
    color: var(--brand-600);
    text-align: center;
}

.celebrate-sub {
    position: relative;
    z-index: 1;
    font: 600 1rem/1.2 system-ui, Arial;
    color: var(--brand-ink);
    text-align: center;
    opacity: .9;
}

/* Full-bleed canvas behind text */
.fireworks-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

/* Reduced motion fallback */
@media (prefers-reduced-motion: reduce) {
    .fireworks-canvas {
        display: none;
    }

    .celebrate-pane {
        background: radial-gradient(ellipse at 20% 30%, color-mix(in srgb, var(--brand) 20%, transparent) 0 40%, transparent 60%), radial-gradient(ellipse at 80% 70%, color-mix(in srgb, var(--brand-600) 20%, transparent) 0 40%, transparent 60%), linear-gradient(180deg, var(--brand-100), var(--brand-50));
    }
}
