/**
 * Chapter Countdown Styles
 * Optimized for performance and theme compatibility
 */

.chapter-countdown {
    /* CSS Custom Properties - Scoped to avoid conflicts */
    --countdown-border: #555;
    --countdown-text: #eee;
    --countdown-highlight: #052d49;
    --countdown-shadow: rgba(0, 0, 0, 0.5);
    --countdown-bg: rgba(255, 255, 255, 0.6);
    
    /* Layout */
    padding: 25px;
    border: 2px solid var(--countdown-border);
    border-radius: 12px;
    text-align: center;
    max-width: 450px;
    margin: 30px auto;
    box-shadow: 0 6px 12px var(--countdown-shadow);
    
    /* Performance optimizations */
    will-change: transform, opacity;
    transform: translateY(20px) translateZ(0); /* Hardware acceleration */
    opacity: 0;
    transition: opacity 0.5s ease-in, transform 0.5s ease;
    
    /* Hidden state */
    display: none;
}

/* Light mode support */
:root[data-mode="light"] .chapter-countdown,
.chapter-countdown[data-mode="light"] {
    --countdown-border: #ddd;
    --countdown-text: #052d49;
    --countdown-shadow: rgba(0, 0, 0, 0.1);
}

/* Show state */
.chapter-countdown.show {
    display: block;
    opacity: 1;
    transform: translateY(0) translateZ(0);
}

/* Typography */
.countdown-title {
    font-size: 1.4em;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    color: var(--countdown-text);
    margin: 0;
    font-weight: 400;
}

.countdown-timer {
    display: inline-block;
    font-weight: 700;
    color: var(--countdown-highlight);
    padding: 5px 10px;
    border-radius: 8px;
    background: var(--countdown-bg);
    box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.1);
    margin-left: 0.5em;
    min-width: 120px;
    text-align: center;
}

/* Responsive design */
@media (max-width: 480px) {
    .chapter-countdown {
        padding: 20px;
        font-size: 0.95em;
        margin: 20px 10px;
    }
    
    .countdown-title {
        font-size: 1.2em;
    }
    
    .countdown-timer {
        display: block;
        margin: 10px auto 0;
        min-width: auto;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .chapter-countdown {
        transition: opacity 0.3s ease;
        transform: none;
    }
    
    .chapter-countdown.show {
        transform: none;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .chapter-countdown {
        --countdown-border: #000;
        --countdown-text: #000;
        --countdown-highlight: #000;
        border-width: 3px;
    }
}
