/* ============================================================
   OPENING SCREEN — ZHENTAR P.G.
   Animasi pembuka saat pertama kali masuk web
   (TEMA MONOKROM HITAM, ABU-ABU, DAN PUTIH)
   ============================================================ */

.opening-screen {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: #000000;
    background-image:
        radial-gradient(ellipse 70% 50% at 50% 40%, rgba(255, 255, 255, 0.12) 0%, transparent 65%),
        radial-gradient(circle at 50% 50%, #242424 0%, #080808 72%, #000000 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    overflow: hidden;
    transition: opacity 2.0s ease, visibility 2.0s ease;
}

/* Grid pattern halus di background opening */
.opening-screen::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
    background-size: 60px 60px;
    mask-image: radial-gradient(ellipse at center, black 20%, transparent 70%);
    -webkit-mask-image: radial-gradient(ellipse at center, black 20%, transparent 70%);
    animation: gridShift 20s linear infinite;
    pointer-events: none;
}

@keyframes gridShift {
    0%   { background-position: 0 0; }
    100% { background-position: 60px 60px; }
}

/* Sembunyikan saat selesai */
.opening-screen.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* Cincin dekoratif berputar */
.opening-ring {
    position: absolute;
    border-radius: 50%;
    border: 1px dashed rgba(220, 220, 220, 0.15);
    pointer-events: none;
}

.opening-ring.ring-1 {
    width: 320px;
    height: 320px;
    animation: spinSlow 25s linear infinite;
}

.opening-ring.ring-2 {
    width: 480px;
    height: 480px;
    border-style: solid;
    border-color: rgba(220, 220, 220, 0.08);
    animation: spinSlow 40s linear infinite reverse;
}

.opening-ring.ring-3 {
    width: 640px;
    height: 640px;
    animation: spinSlow 60s linear infinite;
}

@keyframes spinSlow {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* Konten tengah */
.opening-content {
    position: relative;
    z-index: 2;
    text-align: center;
    padding: 0 1.5rem;
}

/* Logo ZHENTAR */
.opening-logo {
    position: relative;
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(2.8rem, 10vw, 5.5rem);
    font-weight: 700;
    letter-spacing: 12px;
    color: #f2f2f2;
    margin-bottom: 0.8rem;
    display: inline-block;
    background: linear-gradient(110deg, #ffffff 5%, #858585 48%, #eeeeee 78%, #a0a0a0);
    background-size: 220% 100%;
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.12);
    opacity: 0;
    transform: translateY(30px);
    animation:
        logoReveal 1s cubic-bezier(0.22, 1, 0.36, 1) 0.3s forwards,
        openingGradient 7s ease-in-out 1.3s infinite alternate;
}

@keyframes openingGradient {
    to { background-position: 100% 50%; }
}

.opening-bolt {
    position: absolute;
    inset: -35% -7%;
    width: 114%;
    height: 170%;
    overflow: visible;
    opacity: 0;
    pointer-events: none;
    z-index: 1;
    filter: drop-shadow(0 0 5px #ffffff) drop-shadow(0 0 16px #777777);
}

.opening-bolt polyline {
    fill: none;
    stroke: #ffffff;
    stroke-width: 5;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 500;
    stroke-dashoffset: 500;
}

.opening-screen.lightning-strike .opening-bolt {
    opacity: 1;
    animation: openingBoltFlash 520ms ease-out both;
}

.opening-screen.lightning-strike .opening-bolt polyline {
    animation: openingBoltDraw 300ms ease-out both;
}

.opening-screen.lightning-strike .opening-logo {
    filter: brightness(1.7);
    text-shadow: 0 0 14px rgba(255, 255, 255, 0.9), 0 0 44px rgba(190, 190, 190, 0.65);
}

.opening-screen.lightning-strike .opening-logo span {
    text-shadow: 0 0 16px #ffffff, 0 0 38px #cfcfcf;
}

@keyframes openingBoltDraw {
    0% { stroke-dashoffset: 500; }
    100% { stroke-dashoffset: 0; }
}

@keyframes openingBoltFlash {
    0%, 100% { opacity: 0; }
    10%, 35% { opacity: 1; }
    55% { opacity: 0.35; }
}

.opening-logo span {
    color: #ffffff;
    background: linear-gradient(135deg, #ffffff, #aaaaaa 55%, #f5f5f5);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 30px rgba(255, 255, 255, 0.35);
}

@keyframes logoReveal {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Subtitle */
.opening-subtitle {
    font-family: 'Inter', sans-serif;
    font-size: clamp(0.8rem, 2.5vw, 1rem);
    color: #b0b0b0;
    letter-spacing: 4px;
    text-transform: uppercase;
    margin-bottom: 2.5rem;
    opacity: 0;
    transform: translateY(20px);
    animation: logoReveal 1s cubic-bezier(0.22, 1, 0.36, 1) 0.7s forwards;
}

.opening-subtitle .dot {
    display: inline-block;
    width: 5px;
    height: 5px;
    background: linear-gradient(135deg, #ffffff, #8c8c8c);
    border-radius: 50%;
    margin: 0 8px;
    vertical-align: middle;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.65);
    animation: blink 1.5s ease-in-out infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.3; }
}

/* Garis loading di bawah */
.opening-loader {
    width: 220px;
    height: 2px;
    background: rgba(220, 220, 220, 0.14);
    border-radius: 2px;
    margin: 0 auto;
    overflow: hidden;
    position: relative;
    opacity: 0;
    animation: logoReveal 0.8s ease 1s forwards;
}

.opening-loader::after {
    content: "";
    position: absolute;
    top: 0;
    left: -40%;
    width: 40%;
    height: 100%;
    background: linear-gradient(90deg, transparent, #ffffff, #777777, transparent);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.45);
    animation: loaderSlide 1.8s ease-in-out infinite;
}

@keyframes loaderSlide {
    0%   { left: -40%; }
    100% { left: 100%; }
}

/* Teks loading kecil */
.opening-loading-text {
    margin-top: 1.2rem;
    font-family: 'Inter', sans-serif;
    font-size: 0.75rem;
    color: #6b6b6b;
    letter-spacing: 3px;
    text-transform: uppercase;
    opacity: 0;
    animation: logoReveal 0.8s ease 1.3s forwards;
}

.opening-loading-text::after {
    content: "...";
    display: inline-block;
    width: 0;
    overflow: hidden;
    vertical-align: bottom;
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    to { width: 1.5em; }
}

/* Particle dots melayang */
.opening-particle {
    position: absolute;
    width: 3px;
    height: 3px;
    background: linear-gradient(135deg, #ffffff, #929292);
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.45);
    opacity: 0.5;
    animation: particleFloat 8s ease-in-out infinite;
}

.opening-particle:nth-child(1) { top: 20%; left: 15%; animation-delay: 0s; }
.opening-particle:nth-child(2) { top: 70%; left: 25%; animation-delay: 1.5s; }
.opening-particle:nth-child(3) { top: 35%; left: 80%; animation-delay: 0.8s; }
.opening-particle:nth-child(4) { top: 80%; left: 70%; animation-delay: 2.2s; }
.opening-particle:nth-child(5) { top: 15%; left: 60%; animation-delay: 1.1s; }
.opening-particle:nth-child(6) { top: 55%; left: 45%; animation-delay: 3s; }

@keyframes particleFloat {
    0%, 100% { transform: translateY(0) scale(1); opacity: 0.5; }
    50%      { transform: translateY(-40px) scale(1.4); opacity: 0.9; }
}

/* Progress percentage (opsional) */
.opening-percent {
    position: absolute;
    bottom: 3rem;
    right: 3rem;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.85rem;
    color: #6b6b6b;
    letter-spacing: 2px;
    opacity: 0;
    animation: logoReveal 0.8s ease 1.5s forwards;
}

.opening-percent span {
    color: #e5e5e5;
    font-weight: 700;
}

/* Sembunyikan konten utama saat opening */
body.opening-active {
    overflow: hidden;
}

body.opening-active > *:not(.opening-screen) {
    opacity: 0;
}

body.opening-done > *:not(.opening-screen) {
    opacity: 1;
    transition: opacity 0.8s ease 0.2s;
}

/* Responsive */
@media (max-width: 600px) {
    .opening-logo {
        letter-spacing: 6px;
    }

    .opening-subtitle {
        letter-spacing: 2px;
    }

    .opening-ring.ring-1 { width: 220px; height: 220px; }
    .opening-ring.ring-2 { width: 320px; height: 320px; }
    .opening-ring.ring-3 { width: 420px; height: 420px; }

    .opening-percent {
        bottom: 1.5rem;
        right: 1.5rem;
        font-size: 0.75rem;
    }

    .opening-loader {
        width: 160px;
    }
}

/* Aksesibilitas */
@media (prefers-reduced-motion: reduce) {
    .opening-screen *,
    .opening-screen::before {
        animation: none !important;
    }
    .opening-logo,
    .opening-subtitle,
    .opening-loader,
    .opening-loading-text,
    .opening-percent {
        opacity: 1 !important;
        transform: none !important;
    }

    .opening-bolt {
        display: none;
    }
}