/* ====== Design Tokens ====== */
:root {
    --bg: radial-gradient(1200px 600px at 10% -10%, #ffe1d6 0%, transparent 60%),
        radial-gradient(1200px 600px at 110% 10%, #d6e8ff 0%, transparent 60%),
        linear-gradient(180deg, #fff, #f7f7fb);
    --card-bg: rgba(255, 255, 255, 0.55);
    --card-stroke: rgba(255, 255, 255, 0.6);
    --text-1: #1e1e28;
    --text-2: #5a5a6a;
    --accent: #ff7143;
    --accent-2: #6aa9ff;
    --shadow: 0 20px 40px rgba(24, 39, 75, 0.18), 0 2px 8px rgba(24, 39, 75, 0.06);
}

/* ====== Layout ====== */
/* Counter section stays within the viewport */
.counter-wrap {
    width: 100%;
    max-width: 100vw;
    overflow: hidden;
    display: flex;
    justify-content: center;
    padding: clamp(16px, 4vw, 40px);
    background: var(--bg);
    box-sizing: border-box;
}

/* Card never exceeds the viewport width */
.counter-card {
    width: min(720px, 100%);
    max-width: 100%;
    box-sizing: border-box;
    position: relative;
    border-radius: 22px;
    padding: clamp(16px, 4vw, 40px);
    background: var(--card-bg);
    backdrop-filter: blur(14px) saturate(120%);
    -webkit-backdrop-filter: blur(14px) saturate(120%);
    box-shadow: var(--shadow);
    border: 1px solid var(--card-stroke);
    overflow: hidden;
    transform: translateZ(0);
    box-sizing: border-box;
}

body.dark .counter-card {
    background-color: #467db4;
    color: #000;
}

/* subtle animated border glow */
.counter-card::before {
    content: "";
    position: absolute;
    inset: 0;
    filter: blur(8px);
    border-radius: 24px;
    background:
        linear-gradient(120deg, rgba(255, 113, 67, 0.28), rgba(106, 169, 255, 0.28));
    opacity: .6;
    z-index: 0;
    pointer-events: none;
}

/* ====== Header ====== */
.counter-header {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 14px;
    padding-bottom: 12px;
    border-bottom: 1px dashed var(--card-stroke);
}

.counter-icon {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    fill: var(--accent-2);
    filter: drop-shadow(0 4px 10px rgba(106, 169, 255, .35));
}

.counter-titles {
    line-height: 1.15
}

.counter-title {
    margin: 0;
    font-size: clamp(1.1rem, 1.6rem, 1.6rem);
    color: var(--text-1);
    letter-spacing: .2px;
}

.counter-subtitle {
    margin: .25rem 0 0;
    font-size: .95rem;
    color: var(--text-2);
}

/* ====== Body ====== */
.counter-body {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 4px;
}

.counter-label {
    font-size: .95rem;
    color: var(--text-2);
}

.counter-value-wrap {
    margin-left: auto;
}

.counter-value {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 9ch;
    font-variant-numeric: tabular-nums lining-nums;
    font-weight: 800;
    letter-spacing: .5px;
    font-size: clamp(2.2rem, 5vw, 3rem);
    color: var(--text-1);
    padding: 6px 12px;
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(255, 255, 255, .45), rgba(255, 255, 255, .1));
    border: 1px solid var(--card-stroke);
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, .06), 0 6px 18px rgba(255, 113, 67, .15);
}

/* shimmer while loading */
.shimmer {
    position: relative;
    color: transparent !important;
}

.shimmer::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(100deg, transparent 20%, rgba(255, 255, 255, .55) 40%, transparent 60%);
    animation: shimmer 1.2s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(100%);
    }
}

/* “pop” & count-up pulse */
@keyframes popNumber {
    0% {
        transform: scale(1);
        text-shadow: none;
    }

    45% {
        transform: scale(1.12);
        text-shadow: 0 6px 18px rgba(255, 113, 67, .35);
    }

    100% {
        transform: scale(1);
        text-shadow: none;
    }
}

.pop {
    animation: popNumber .36s ease;
}

/* ====== Footer ====== */
.counter-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding-top: 8px;
}

.ghost-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 12px;
    background: transparent;
    border: 3px solid var(--card-stroke);
    color: var(--text-1);
    cursor: pointer;
    transition: transform .16s ease, box-shadow .2s ease, background-color .2s ease;
}

body.dark .ghost-btn {
    color: #eaf2ff;
    border-color: rgba(140, 170, 255, .25);
}

.ghost-btn svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

.ghost-btn:hover {
    background: linear-gradient(180deg, rgba(255, 255, 255, .25), rgba(255, 255, 255, .08));
    box-shadow: 0 6px 16px rgba(0, 0, 0, .08);
    transform: translateY(-1px);
}

.ghost-btn:active {
    transform: translateY(0);
}

/* ====== Respect reduced motion ====== */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        transition: none !important;
    }
}

/* ===== Compact Theme ===== */
.counter-card.theme-compact {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 12px;
    border-radius: 14px;
    padding: 14px 16px;
    background: rgba(255, 255, 255, .7);
    border: 1px solid rgba(0, 0, 0, .06);
    box-shadow: 0 8px 20px rgba(0, 0, 0, .08);
}

.counter-card.theme-compact .counter-header {
    border: 0;
    padding: 0;
    grid-column: 1 / span 2;
}

.counter-card.theme-compact .counter-body {
    padding: 0;
    grid-column: 3;
}

.counter-card.theme-compact .counter-title {
    font-size: 1rem;
    margin: 0;
}

.counter-card.theme-compact .counter-subtitle {
    display: none;
}

.counter-card.theme-compact .counter-value {
    font-size: clamp(1.6rem, 5vw, 2rem);
    padding: 4px 10px;
    border-radius: 10px;
    background: linear-gradient(180deg, rgba(255, 255, 255, .7), rgba(255, 255, 255, .3));
    border: 1px solid rgba(0, 0, 0, .06);
}

@media (prefers-color-scheme: dark) {
    .counter-card.theme-compact {
        background: rgba(18, 22, 29, .6);
        border-color: rgba(255, 255, 255, .08);
        box-shadow: 0 16px 36px rgba(0, 0, 0, .4);
    }
}

/* ===== Neon Theme ===== */
.counter-card.theme-neon {
    position: relative;
    border-radius: 20px;
    background: rgba(12, 14, 22, .6);
    color: #eaf2ff;
    border: 1px solid rgba(140, 170, 255, .25);
    box-shadow: 0 20px 50px rgba(0, 0, 0, .5), inset 0 0 0 1px rgba(255, 255, 255, .03);
    backdrop-filter: blur(14px) saturate(120%);
}

.counter-card.theme-neon::before {
    content: "";
    position: absolute;
    inset: -2px;
    border-radius: 22px;
    background: conic-gradient(from 120deg,
            #6aa9ff, #b86bff, #ff6a95, #ff9b6a, #6aa9ff);
    filter: blur(18px);
    opacity: .35;
    pointer-events: none;
}

.counter-card.theme-neon .counter-title {
    color: #cfe1ff;
}

.counter-card.theme-neon .counter-subtitle {
    color: #9fb6e8;
}

.counter-card.theme-neon .counter-value {
    color: #ffffff;
    background: rgba(255, 255, 255, .06);
    border: 1px solid rgba(140, 170, 255, .2);
    box-shadow: 0 10px 30px rgba(106, 169, 255, .25), inset 0 0 18px rgba(106, 169, 255, .08);
}

.counter-card.theme-neon .ghost-btn {
    color: #eaf2ff;
    border-color: rgba(140, 170, 255, .25);
}

.counter-card.theme-neon .ghost-btn:hover {
    background: rgba(140, 170, 255, .12);
    box-shadow: 0 10px 24px rgba(106, 169, 255, .2);
}

/* ===== Minimal Theme ===== */
.counter-card.theme-minimal {
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(255, 255, 255, .7), rgba(255, 255, 255, .4));
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, .6);
    box-shadow: 0 12px 28px rgba(16, 24, 40, .12);
}

.counter-card.theme-minimal .counter-title {
    font-size: clamp(1.1rem, 1.6rem, 1.6rem);
    letter-spacing: .2px;
}

.counter-card.theme-minimal .counter-value {
    font-size: clamp(2.4rem, 6vw, 3.2rem);
    font-weight: 800;
    background: linear-gradient(180deg, rgba(255, 255, 255, .55), rgba(255, 255, 255, .15));
    border: 1px solid rgba(0, 0, 0, .06);
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, .06);
}

@media (prefers-color-scheme: dark) {
    .counter-card.theme-minimal {
        background: linear-gradient(180deg, rgba(18, 22, 29, .7), rgba(18, 22, 29, .4));
        border-color: rgba(255, 255, 255, .08);
        box-shadow: 0 20px 40px rgba(0, 0, 0, .45);
    }
}

#visitor-counter {
    /* margin-bottom: 40px; */
    /* adjust as needed */
}
