/*
 * krakryp/assets/css/loader.css
 * Pantalla de carga global de Krakryp (temática blockchain / cripto).
 * Se enlaza en el <head> para que el loader aparezca desde el primer pintado.
 */

#kk-loader {
    --kk-gold: #FFD24A;
    --kk-gold-2: #DAA520;
    --kk-bg-1: #1f2d3a;
    --kk-bg-2: #0d141c;
    --kk-text: rgba(255, 255, 255, .78);

    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: radial-gradient(ellipse at center, var(--kk-bg-1) 0%, var(--kk-bg-2) 75%);
    color: var(--kk-text);
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    opacity: 1;
    visibility: visible;
    transition: opacity .55s ease, visibility .55s ease;
}

#kk-loader.kk-loader--hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

html.kk-loading,
html.kk-loading body { overflow: hidden; }

/* ---------- Fondo: rejilla de red blockchain ---------- */
.kk-grid {
    position: absolute;
    inset: -50%;
    background-image:
        linear-gradient(rgba(255, 210, 74, .07) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 210, 74, .07) 1px, transparent 1px);
    background-size: 48px 48px;
    transform: perspective(600px) rotateX(55deg);
    animation: kk-grid-move 6s linear infinite;
    -webkit-mask-image: radial-gradient(circle at 50% 40%, #000 0%, transparent 60%);
    mask-image: radial-gradient(circle at 50% 40%, #000 0%, transparent 60%);
}

@keyframes kk-grid-move {
    to { background-position: 0 48px, 48px 0; }
}

/* Partículas de "datos" que suben (se desvanecen en el centro para no tapar el texto) */
.kk-particles {
    position: absolute;
    inset: 0;
    -webkit-mask-image: radial-gradient(ellipse 260px 240px at 50% 50%, transparent 60%, #000 100%);
    mask-image: radial-gradient(ellipse 260px 240px at 50% 50%, transparent 60%, #000 100%);
}

.kk-particles span {
    position: absolute;
    bottom: -20px;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;
    font-size: 12px;
    color: rgba(255, 210, 74, .35);
    animation: kk-rise linear infinite;
    white-space: nowrap;
}

.kk-particles span:nth-child(1) { left: 8%;  animation-duration: 9s;  animation-delay: -1s; }
.kk-particles span:nth-child(2) { left: 22%; animation-duration: 12s; animation-delay: -6s; }
.kk-particles span:nth-child(3) { left: 38%; animation-duration: 10s; animation-delay: -3s; }
.kk-particles span:nth-child(4) { left: 63%; animation-duration: 11s; animation-delay: -8s; }
.kk-particles span:nth-child(5) { left: 78%; animation-duration: 8s;  animation-delay: -2s; }
.kk-particles span:nth-child(6) { left: 91%; animation-duration: 13s; animation-delay: -5s; }

@keyframes kk-rise {
    0%   { transform: translateY(0);      opacity: 0; }
    10%  { opacity: 1; }
    90%  { opacity: 1; }
    100% { transform: translateY(-110vh); opacity: 0; }
}

/* ---------- Contenido central ---------- */
.kk-center {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 0 16px;
}

/* Núcleo: emblema + anillos + monedas en órbita */
.kk-core {
    position: relative;
    width: 190px;
    height: 190px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 28px;
}

.kk-ring {
    position: absolute;
    border-radius: 50%;
}

/* Arco dorado giratorio */
.kk-ring--arc {
    inset: 18px;
    background: conic-gradient(from 0deg, transparent 0 55%, var(--kk-gold-2) 75%, var(--kk-gold) 100%);
    -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px));
    mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px));
    animation: kk-spin 1.4s linear infinite;
}

/* Anillo discontinuo en sentido contrario */
.kk-ring--dash {
    inset: 6px;
    border: 1px dashed rgba(255, 210, 74, .35);
    animation: kk-spin 9s linear infinite reverse;
}

/* Órbita de monedas */
.kk-orbit {
    position: absolute;
    inset: 0;
    animation: kk-spin 7s linear infinite;
}

.kk-coin {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 30px;
    margin: -15px 0 0 -15px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 700;
    color: #1f2d3a;
    background: linear-gradient(145deg, #ffe58a, var(--kk-gold-2));
    box-shadow: 0 0 12px rgba(255, 210, 74, .55), inset 0 -2px 0 rgba(0, 0, 0, .2);
}

/* Coloca cada moneda en el borde y contrarresta el giro para que el símbolo quede recto */
.kk-coin:nth-child(1) { transform: rotate(0deg)   translateX(95px) rotate(0deg); }
.kk-coin:nth-child(2) { transform: rotate(90deg)  translateX(95px) rotate(-90deg); }
.kk-coin:nth-child(3) { transform: rotate(180deg) translateX(95px) rotate(-180deg); }
.kk-coin:nth-child(4) { transform: rotate(270deg) translateX(95px) rotate(-270deg); }

.kk-coin i { animation: kk-spin 7s linear infinite reverse; display: inline-block; font-style: normal; }

/* Emblema del logo */
.kk-emblem {
    position: relative;
    width: 104px;
    height: 104px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle, rgba(255, 210, 74, .18), rgba(255, 210, 74, 0) 70%);
    animation: kk-pulse 2s ease-in-out infinite;
}

.kk-emblem img {
    width: 84px;
    height: 84px;
    object-fit: contain;
    filter: drop-shadow(0 0 10px rgba(255, 210, 74, .55));
}

@keyframes kk-spin  { to { transform: rotate(360deg); } }
@keyframes kk-pulse {
    0%, 100% { transform: scale(1);    }
    50%      { transform: scale(1.06); }
}

/* Marca con brillo */
.kk-brand {
    margin: 0 0 6px;
    font-size: 30px;
    font-weight: 700;
    letter-spacing: .32em;
    padding-left: .32em;
    background: linear-gradient(90deg, var(--kk-gold-2) 0%, #fff6cf 50%, var(--kk-gold-2) 100%);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: kk-shine 2.6s linear infinite;
}

@keyframes kk-shine { to { background-position: -200% 0; } }

.kk-tagline {
    margin: 0 0 22px;
    font-size: 12px;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, .5);
}

/* Barra de progreso en forma de bloques encadenados */
.kk-chain {
    display: flex;
    align-items: center;
    gap: 0;
    margin-bottom: 16px;
}

.kk-block {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    border: 1px solid rgba(255, 210, 74, .45);
    background: rgba(255, 210, 74, .06);
    animation: kk-mine 1.6s ease-in-out infinite;
}

.kk-link {
    width: 10px;
    height: 2px;
    background: rgba(255, 210, 74, .3);
}

.kk-chain .kk-block:nth-of-type(1) { animation-delay: 0s; }
.kk-chain .kk-block:nth-of-type(2) { animation-delay: .2s; }
.kk-chain .kk-block:nth-of-type(3) { animation-delay: .4s; }
.kk-chain .kk-block:nth-of-type(4) { animation-delay: .6s; }
.kk-chain .kk-block:nth-of-type(5) { animation-delay: .8s; }
.kk-chain .kk-block:nth-of-type(6) { animation-delay: 1s; }

@keyframes kk-mine {
    0%, 60%, 100% { background: rgba(255, 210, 74, .06); box-shadow: none; }
    25%           { background: var(--kk-gold); box-shadow: 0 0 10px rgba(255, 210, 74, .8); }
}

.kk-status {
    min-height: 20px;
    margin: 0 0 6px;
    font-size: 14px;
    font-weight: 600;
    color: var(--kk-text);
    transition: opacity .25s ease;
}

.kk-hash {
    margin: 0;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;
    font-size: 11px;
    color: rgba(255, 210, 74, .55);
    max-width: 90vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ---------- Responsive ---------- */
@media (max-width: 400px) {
    .kk-core { width: 160px; height: 160px; }
    .kk-coin:nth-child(1) { transform: rotate(0deg)   translateX(80px) rotate(0deg); }
    .kk-coin:nth-child(2) { transform: rotate(90deg)  translateX(80px) rotate(-90deg); }
    .kk-coin:nth-child(3) { transform: rotate(180deg) translateX(80px) rotate(-180deg); }
    .kk-coin:nth-child(4) { transform: rotate(270deg) translateX(80px) rotate(-270deg); }
    .kk-brand { font-size: 24px; }
}

/* ---------- Accesibilidad: menos movimiento ---------- */
@media (prefers-reduced-motion: reduce) {
    #kk-loader *,
    #kk-loader *::before,
    #kk-loader *::after {
        animation-duration: 0s !important;
        animation-iteration-count: 1 !important;
    }
    /* Solo se mantiene un giro lento del arco para indicar que está cargando */
    #kk-loader .kk-ring--arc {
        animation-duration: 2.5s !important;
        animation-iteration-count: infinite !important;
    }
}
