/*
 * WWC 3D Preloader — Frontend Overlay Styles
 * Version: 1.1.0
 * Package: wwc-3d-preloader
 */

/* ── Overlay ──────────────────────────────────────────────────── */

#wwc-preloader {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    will-change: opacity, transform;
}

/* Canvas wrapper + Three.js container */
.wwc-preloader-canvas-wrap {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 6;
}

#wwc-canvas-container {
    position: absolute;
    inset: 0;
}

#wwc-canvas-container canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
}

/* ── Video mode ──────────────────────────────────────────────── */

.wwc-video-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 6;
    pointer-events: none;
}

/* Logo image (legacy branding) */
.wwc-preloader-logo {
    position: relative;
    z-index: 2;
    margin-bottom: 1rem;
}

.wwc-preloader-logo img {
    max-width: 160px;
    max-height: 80px;
    object-fit: contain;
    filter: drop-shadow(0 0 12px rgba(255,255,255,0.3));
}

/* Text label (legacy branding) */
.wwc-preloader-text {
    position: relative;
    z-index: 2;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 0.85rem;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.5);
    margin-top: 2rem;
}

/* ── Intro Lines ─────────────────────────────────────────────── */

.wwc-intro-line {
    position: absolute;
    background: var(--wwc-line-color, #ffffff);
    z-index: 5;
    transition-timing-function: cubic-bezier(0.77, 0, 0.18, 1);
    transition-duration: 0.65s;
    opacity: 1;
}

/* Vertical lines — top & bottom, meet at 50% */
.wwc-lv-top {
    left: 50%;
    top: 0;
    width: 2px;
    height: 0;
    transform: translateX(-50%);
    transition-property: height;
}

.wwc-lv-bot {
    left: 50%;
    bottom: 0;
    width: 2px;
    height: 0;
    transform: translateX(-50%);
    transition-property: height;
}

.wwc-lv-top.wwc-line-active,
.wwc-lv-bot.wwc-line-active {
    height: 50%;
}

/* Horizontal lines — left & right, meet at 50% */
.wwc-lh-left {
    top: 50%;
    left: 0;
    height: 2px;
    width: 0;
    transform: translateY(-50%);
    transition-property: width;
}

.wwc-lh-right {
    top: 50%;
    right: 0;
    height: 2px;
    width: 0;
    transform: translateY(-50%);
    transition-property: width;
}

.wwc-lh-left.wwc-line-active,
.wwc-lh-right.wwc-line-active {
    width: 50%;
}

/* Fade out intro lines after logo reveals */
.wwc-intro-line.wwc-line-fade {
    opacity: 0;
    transition: opacity 0.5s ease;
}

/* Fade out SVG curve intro lines */
svg.wwc-line-fade {
    opacity: 0;
    transition: opacity 0.5s ease;
}

/* ── Glitch Effect ───────────────────────────────────────────── */

@keyframes wwcGlitch {
    0%   { transform: translate(0) skewX(0);    filter: none; }
    20%  { transform: translate(-4px, 2px) skewX(-1.5deg); filter: hue-rotate(80deg) contrast(1.3); }
    40%  { transform: translate(4px, -2px) skewX(1.5deg);  filter: hue-rotate(-80deg) brightness(1.4); }
    60%  { transform: translate(-2px, 3px) skewX(-1deg);   filter: saturate(2); }
    80%  { transform: translate(3px, -1px);                filter: none; }
    100% { transform: translate(0) skewX(0);    filter: none; }
}

#wwc-preloader.wwc-glitching .wwc-preloader-canvas-wrap {
    animation: wwcGlitch 0.16s steps(1) forwards;
}

/* ── Exit — Line Wipe ────────────────────────────────────────── */

.wwc-exit-wipe {
    position: absolute;
    inset: 0;
    background: var(--wwc-wipe-color, #ffffff);
    z-index: 8;
}

/* Vertical wipe: bar expands left+right from center */
.wwc-wipe-v {
    clip-path: inset(0 50% 0 50%);
    transition: clip-path 0.72s cubic-bezier(0.77, 0, 0.18, 1);
}

.wwc-wipe-v.wwc-wipe-active {
    clip-path: inset(0 0% 0 0%);
}

/* Horizontal wipe: bar expands up+down from center */
.wwc-wipe-h {
    clip-path: inset(50% 0 50% 0);
    transition: clip-path 0.72s cubic-bezier(0.77, 0, 0.18, 1);
}

.wwc-wipe-h.wwc-wipe-active {
    clip-path: inset(0% 0 0% 0);
}

/* ── Exit — Split Panels ─────────────────────────────────────── */

.wwc-split-panel {
    position: absolute;
    background: var(--wwc-wipe-color, #ffffff);
    z-index: 8;
    transition: transform 0.72s cubic-bezier(0.77, 0, 0.18, 1);
}

/* Horizontal intro → top half goes left, bottom half goes right */
.wwc-split-h-top {
    top: 0; left: 0; right: 0;
    height: 50%;
}
.wwc-split-h-top.wwc-split-active { transform: translateX(-105%); }

.wwc-split-h-bot {
    bottom: 0; left: 0; right: 0;
    height: 50%;
}
.wwc-split-h-bot.wwc-split-active { transform: translateX(105%); }

/* Vertical intro → left half goes up, right half goes down */
.wwc-split-v-left {
    top: 0; bottom: 0; left: 0;
    width: 50%;
}
.wwc-split-v-left.wwc-split-active { transform: translateY(-105%); }

.wwc-split-v-right {
    top: 0; bottom: 0; right: 0;
    width: 50%;
}
.wwc-split-v-right.wwc-split-active { transform: translateY(105%); }

/* 3D canvas fade-out during split exit */
.wwc-canvas-fade {
    transition: opacity 0.45s ease !important;
    opacity: 0 !important;
}

/* ── Exit — Classic Animations ───────────────────────────────── */

#wwc-preloader.wwc-exit-fade {
    animation: wwcFadeOut 0.7s ease forwards;
}

#wwc-preloader.wwc-exit-zoom {
    animation: wwcZoomOut 0.6s ease forwards;
}

#wwc-preloader.wwc-exit-slide-up {
    animation: wwcSlideUp 0.65s cubic-bezier(0.77, 0, 0.18, 1) forwards;
}

@keyframes wwcFadeOut {
    from { opacity: 1; }
    to   { opacity: 0; pointer-events: none; }
}

@keyframes wwcZoomOut {
    from { opacity: 1; transform: scale(1); }
    to   { opacity: 0; transform: scale(1.08); pointer-events: none; }
}

@keyframes wwcSlideUp {
    from { transform: translateY(0); }
    to   { transform: translateY(-100%); }
}
