/* ==============================================
   Countdown — Card Boxes (Fixed)
   - Safe by default (no odometer). Numbers won't overflow.
   - Uses theme vars only.
================================================= */

/* Layout container */
.diwali-countdown {
    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;
}

    .diwali-countdown .dc-title {
        font-size: 1.4rem;
        margin-bottom: 12px;
        color: var(--brand-600);
    }

/* Responsive grid that wraps */
.dc-timer {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
}

/* Each box */
.dc-box {
    background: linear-gradient(180deg, var(--brand-100), var(--brand-50));
    border-radius: 12px;
    padding: 12px 10px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.6);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 140px;
    min-height: 100px;
}

/* Icon */
.dc-icon {
    width: 28px;
    height: 28px;
    margin-bottom: 6px;
    color: var(--brand-600);
    flex: 0 0 auto;
}

    .dc-icon svg {
        width: 100%;
        height: 100%;
        fill: currentColor;
    }

/* Value: no overflow, centered, tabular digits */
.dc-value {
    display: block;
    max-width: 100%;
    font-size: clamp(1.2rem, 4.5vw, 1.8rem);
    font-weight: 800;
    color: var(--brand-600);
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Label */
.dc-label {
    margin-top: 4px;
    font-size: .85rem;
    font-weight: 600;
    color: var(--brand-ink);
    text-transform: uppercase;
}

/* ---------------- Optional Odometer ---------------- */
.use-odometer .dc-value {
    display: inline-flex;
    gap: 4px;
    height: var(--digit-h, 2.2rem);
    line-height: var(--digit-h, 2.2rem);
}

.use-odometer .dc-odometer-digit {
    position: relative;
    width: 1.2em;
    overflow: hidden;
    border-radius: 8px;
    background: var(--card-bg, var(--brand-50));
    border: 1px solid var(--brand-border);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.6);
}

.use-odometer .dc-odometer-strip {
    display: block;
    transform: translateY(0);
    transition: transform 350ms cubic-bezier(.2,.6,.2,1);
    will-change: transform;
}

    .use-odometer .dc-odometer-strip span {
        display: block;
        height: var(--digit-h, 2.2rem);
        width: 100%;
        text-align: center;
        font-weight: 800;
        color: var(--brand-600);
    }

/* Mobile tweaks */
@media (max-width:480px) {
    .diwali-countdown {
        padding: 12px;
    }

    .dc-box {
        min-height: 90px;
    }

    .dc-label {
        font-size: .78rem;
    }
}

/* ==============================================
   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; /* ensures nonzero height for canvas */
}

.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;
}

/* Canvas fills the pane behind the 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));
    }
}
