@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;0,600;1,300;1,400&family=Inter:wght@300;400&display=swap');

/* ─── Reset & Base ─── */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-deep: #0a0a0f;
    --bg-mid: #111118;
    --text-ghost: #5a5a72;
    --text-muted: #8888a4;
    --text-pale: #b0b0c8;
    --text-bright: #d4d4e8;
    --accent-sorrow: #6b4c7a;
    --accent-ache: #8b5e6e;
    --accent-tear: #4a5a8a;
    --shadow-glow: rgba(107, 76, 122, 0.15);
}

html,
body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: 'Inter', sans-serif;
    background: var(--bg-deep);
    color: var(--text-pale);
}

/* ─── Rain Canvas ─── */
#rain-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    opacity: 0.4;
}

/* ─── Ambient Fog ─── */
.fog {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
    background:
        radial-gradient(ellipse at 20% 80%, rgba(107, 76, 122, 0.08) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 20%, rgba(74, 90, 138, 0.06) 0%, transparent 60%),
        radial-gradient(ellipse at 50% 50%, rgba(139, 94, 110, 0.04) 0%, transparent 70%);
    animation: fog-drift 20s ease-in-out infinite alternate;
}

@keyframes fog-drift {
    0% {
        transform: translate(0, 0) scale(1);
    }

    100% {
        transform: translate(-20px, 10px) scale(1.05);
    }
}

/* ─── Main Container ─── */
.container {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 2rem;
    text-align: center;
}

/* ─── Title ─── */
.title {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    font-style: italic;
    font-size: clamp(1rem, 3vw, 1.4rem);
    color: var(--text-ghost);
    letter-spacing: 0.3em;
    text-transform: lowercase;
    margin-bottom: 3rem;
    opacity: 0;
    animation: fade-up 2s ease-out 0.5s forwards;
    position: relative;
}

.title::after {
    content: '';
    display: block;
    width: 60px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent-sorrow), transparent);
    margin: 1.2rem auto 0;
    opacity: 0.4;
}

/* ─── Counter ─── */
.counter-wrapper {
    opacity: 0;
    animation: fade-up 2.5s ease-out 1s forwards;
}

/* ─── Counter Digit Row ─── */
.counter-digits {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(0.5rem, 2vw, 1rem);
}

/* ─── Individual Digit Box (clock cell) ─── */
.digit-box {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    font-size: clamp(4rem, 14vw, 9rem);
    line-height: 1;
    color: var(--text-bright);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding-top: 0.15em;
    width: clamp(4.5rem, 14vw, 9rem);
    height: clamp(5.5rem, 18vw, 11.5rem);
    background: linear-gradient(180deg,
            rgba(25, 25, 38, 0.9) 0%,
            rgba(18, 18, 28, 0.95) 48%,
            rgba(15, 15, 24, 0.95) 52%,
            rgba(20, 20, 32, 0.9) 100%);
    border-radius: 12px;
    border: 1px solid rgba(107, 76, 122, 0.15);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.03),
        inset 0 -1px 0 rgba(0, 0, 0, 0.3),
        0 4px 20px rgba(0, 0, 0, 0.4),
        0 0 30px var(--shadow-glow);
    position: relative;
    text-shadow:
        0 0 30px var(--shadow-glow),
        0 0 60px rgba(107, 76, 122, 0.06);
    overflow: hidden;
}

/* Horizontal split line — flip-clock style */
.digit-box::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 1px;
    background: rgba(0, 0, 0, 0.35);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.02);
    pointer-events: none;
}

/* ─── Subtle Breathing Pulse ─── */
@keyframes breathe {

    0%,
    100% {
        opacity: 0.75;
    }

    50% {
        opacity: 1;
    }
}

.digit-box {
    animation: breathe 6s ease-in-out infinite;
}

/* ─── "ngày" label ─── */
.day-label {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 400;
    font-size: clamp(1.2rem, 3.5vw, 1.8rem);
    color: var(--text-ghost);
    letter-spacing: 0.8em;
    text-transform: lowercase;
    margin-top: 1.5rem;
    opacity: 0;
    animation: fade-up 2s ease-out 1.8s forwards;
}

/* ─── Quote ─── */
.quote {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    font-style: italic;
    font-size: clamp(1.1rem, 2.5vw, 1.4rem);
    color: var(--text-ghost);
    max-width: 28em;
    line-height: 1.7;
    margin-top: 2.5rem;
    opacity: 0;
    animation: fade-up 2.5s ease-out 2.5s forwards;
}

/* ─── Bottom whisper (the date) ─── */
.whisper {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Inter', sans-serif;
    font-weight: 300;
    font-size: 0.7rem;
    color: var(--text-ghost);
    letter-spacing: 0.25em;
    opacity: 0;
    animation: fade-in 3s ease-out 3s forwards;
    z-index: 2;
}

/* ─── Animations ─── */
@keyframes fade-up {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fade-in {
    0% {
        opacity: 0;
    }

    100% {
        opacity: 0.35;
    }
}

/* ─── Reduced Motion ─── */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01s !important;
        animation-delay: 0s !important;
        transition-duration: 0.01s !important;
    }

    .fog {
        animation: none;
    }

    #rain-canvas {
        display: none;
    }
}

/* ─── Very small screens ─── */
@media (max-width: 380px) {
    .digit-box {
        font-size: 3rem;
        width: 3.5rem;
        height: 4.5rem;
    }

    .title {
        letter-spacing: 0.15em;
    }
}