*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --white: #ffffff;
    --ink: #111010;
    --ink-faint: #c0bbb0;
    --ink-mid: #7a756a;
    --dot-off: #e8e4dc;
    --dot-on: #8a7f6f;
}

html,
body {
    width: 100%;
    height: 100%;
}

body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100dvh;
    background-color: var(--white);
    font-family: "DM Mono", monospace;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.4s ease;
}

body.dark {
    background-color: var(--ink);
}

body.dark .dot {
    background-color: var(--dot-off);
}

body.dark .loader-label {
    color: var(--ink-faint);
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 180px 180px;
    pointer-events: none;
    z-index: 0;
    opacity: 0.5;
}

.loader-wrap {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    opacity: 0;
    animation: appear 0.8s cubic-bezier(0.22, 1, 0.36, 1) 0.1s forwards;
}

@keyframes appear {
    to {
        opacity: 1;
    }
}

/* ── Três pontos ── */
.dots {
    display: flex;
    align-items: center;
    gap: 10px;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--dot-on);
    animation: pulse 1.4s ease-in-out infinite;
}

.dot:nth-child(1) {
    animation-delay: 0s;
}
.dot:nth-child(2) {
    animation-delay: 0.2s;
}
.dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes pulse {
    0%,
    100% {
        opacity: 0.2;
        transform: scale(0.75);
    }
    50% {
        opacity: 1;
        transform: scale(1);
    }
}

.loader-label {
    font-family: "DM Mono", monospace;
    font-size: 0.55rem;
    font-weight: 300;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--ink-mid);
    user-select: none;
    transition: opacity 0.3s ease;
}

body.leaving .loader-wrap {
    opacity: 0;
    transform: translateY(-8px);
    transition:
        opacity 0.5s ease,
        transform 0.5s ease;
}
