/**
 * เคาน์ดาวน์งานเกษตรนเรศวร — อิงสไตล์จาก cwieday16/event-countdown-section
 */
.hero-header + .agifair-countdown {
    margin-top: 0;
}

.agifair-countdown {
    --acd-green: #61c98a;
    --acd-gold: #e6c04a;
    --acd-mint: #7ee8b8;
    position: relative;
    overflow: hidden;
    padding: 3rem 0 0;
    background: linear-gradient(145deg, #041a0e 0%, #0a2e1a 42%, #0f3d24 100%);
    border-top: 1px solid rgba(97, 201, 138, 0.25);
    border-bottom: 1px solid rgba(25, 135, 84, 0.35);
    color: #f0fdf4;
}

.agifair-countdown__stadium-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background-image:
        radial-gradient(ellipse 90% 70% at 50% 20%, rgba(25, 135, 84, 0.45) 0%, transparent 55%),
        radial-gradient(circle at center, rgba(13, 80, 55, 0.22) 0%, rgba(0, 12, 6, 0.92) 72%);
}

.agifair-countdown__crowd-wave {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 32%;
    z-index: 0;
    pointer-events: none;
    background: linear-gradient(0deg, rgba(25, 135, 84, 0.55) 0%, rgba(15, 61, 36, 0.25) 45%, transparent 100%);
    transform-origin: bottom center;
    animation: acdCrowdWave 8s ease-in-out infinite;
}

.agifair-countdown__flares {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    overflow: hidden;
}

.agifair-countdown__flare {
    position: absolute;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background-color: #fff;
    box-shadow: 0 0 10px 2px rgba(230, 192, 74, 0.75);
    animation: acdFlare 4.5s infinite;
    opacity: 0;
}

.agifair-countdown__content {
    z-index: 2;
    padding-bottom: 3.25rem;
}

.agifair-countdown__event {
    margin-bottom: 1.75rem;
}

.agifair-countdown__tournament {
    font-family: "Kanit", system-ui, sans-serif;
    font-size: clamp(0.9rem, 1.2vw + 0.65rem, 1.25rem);
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
    background: linear-gradient(90deg, var(--acd-green), var(--acd-gold));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}

.agifair-countdown__match-title {
    font-family: "Kanit", system-ui, sans-serif;
    font-size: clamp(1.5rem, 3.5vw + 1rem, 2.35rem);
    font-weight: 700;
    line-height: 1.15;
    margin: 0 0 0.5rem;
    color: #f6f1ea;
    text-shadow: 0 0 28px rgba(97, 201, 138, 0.45);
}

.agifair-countdown__venue {
    font-size: 0.95rem;
    opacity: 0.88;
    margin: 0;
}

.agifair-countdown__tz-pill {
    display: inline-block;
    margin-left: 0.35rem;
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 700;
    background: rgba(212, 175, 55, 0.22);
    color: #ecd078;
}

.agifair-countdown__active {
    margin-bottom: 0;
}

.agifair-countdown__count-wrap {
    position: relative;
    width: 100%;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0.5rem 0 1.25rem;
}

.agifair-countdown__pulse-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    width: clamp(260px, 55vw, 420px);
    height: clamp(260px, 55vw, 420px);
    margin: 0;
    border-radius: 50%;
    border: 2px solid rgba(97, 201, 138, 0.35);
    transform: translate(-50%, -50%);
    animation: acdPulseRing 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
    pointer-events: none;
}

.agifair-countdown__pulse-ring:nth-of-type(2) {
    animation-delay: 0.5s;
}

.agifair-countdown__pulse-ring:nth-of-type(3) {
    animation-delay: 1s;
}

.agifair-countdown__segments {
    position: relative;
    z-index: 2;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.65rem 1.15rem;
    perspective: 1000px;
}

.agifair-countdown__segment {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 4.25rem;
}

.agifair-countdown__segment-value {
    font-family: "Kanit", system-ui, sans-serif;
    font-size: clamp(2.35rem, 7vw + 0.5rem, 4.2rem);
    font-weight: 800;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    background: linear-gradient(135deg, var(--acd-green) 0%, #d4af37 45%, var(--acd-mint) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    position: relative;
    margin-bottom: 0.45rem;
    filter: drop-shadow(0 4px 14px rgba(97, 201, 138, 0.25));
}

.agifair-countdown__segment-value::after {
    content: "";
    position: absolute;
    bottom: -6px;
    left: 50%;
    width: 32px;
    height: 4px;
    margin-left: -16px;
    border-radius: 2px;
    background: linear-gradient(90deg, var(--acd-green), var(--acd-gold));
}

.agifair-countdown__segment-label {
    font-family: "Kanit", system-ui, sans-serif;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(240, 253, 244, 0.68);
}

.agifair-countdown__segment-value.agifair-countdown__beat {
    animation: acdBeat 0.5s ease-out;
}

.agifair-countdown__ticker {
    margin-top: 0.25rem;
    overflow: hidden;
    border-top: 1px solid rgba(97, 201, 138, 0.28);
    border-bottom: 1px solid rgba(97, 201, 138, 0.28);
    background: rgba(4, 26, 14, 0.72);
}

.agifair-countdown__ticker-track {
    display: flex;
    width: max-content;
    animation: acdTicker 38s linear infinite;
}

.agifair-countdown__ticker-group {
    display: flex;
    align-items: center;
    gap: 2.25rem;
    padding: 0.85rem 2rem;
    white-space: nowrap;
}

.agifair-countdown__ticker-item {
    font-family: "Kanit", system-ui, sans-serif;
    font-weight: 700;
    font-size: 0.82rem;
    color: rgba(240, 253, 244, 0.9);
}

.agifair-countdown__ticker-item--hl {
    color: var(--acd-mint);
}

.agifair-countdown-ended {
    text-align: center;
    padding: 2rem 1rem 2.5rem;
    overflow: visible;
}

.agifair-countdown-ended__msg {
    display: inline-block;
    max-width: min(100%, 32rem);
    margin: 0;
    padding: 0.35em 0.65em 0.2em;
    font-size: clamp(1.35rem, 3.2vw + 0.85rem, 2rem);
    font-weight: 700;
    font-family: "Kanit", system-ui, sans-serif;
    line-height: 1.65;
    color: #7ee8b8;
    text-shadow:
        0 0 24px rgba(97, 201, 138, 0.45),
        0 2px 14px rgba(0, 0, 0, 0.4);
}

@keyframes acdCrowdWave {
    0%, 100% { transform: scaleY(1); }
    50% { transform: scaleY(1.12); }
}

@keyframes acdPulseRing {
    0% {
        transform: translate(-50%, -50%) scale(0.78);
        opacity: 0.75;
    }
    70% { opacity: 0.18; }
    100% {
        transform: translate(-50%, -50%) scale(1.12);
        opacity: 0;
    }
}

@keyframes acdBeat {
    0% { transform: scale(1); }
    50% { transform: scale(1.08); }
    100% { transform: scale(1); }
}

@keyframes acdTicker {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

@keyframes acdFlare {
    0% {
        opacity: 0;
        transform: scale(0);
    }
    18% {
        opacity: 1;
        transform: scale(1);
    }
    100% {
        opacity: 0;
        transform: scale(0);
    }
}

@media (prefers-reduced-motion: reduce) {
    .agifair-countdown__crowd-wave,
    .agifair-countdown__pulse-ring,
    .agifair-countdown__flare,
    .agifair-countdown__ticker-track {
        animation: none;
    }
}
