/* ══════════════════════════════════════════════
   MOTION.CSS — Advanced UI & Animation Layer
   Layered on top of styles.css — does NOT replace anything.
   ══════════════════════════════════════════════ */

/* ── PRELOADER ── */
.preloader {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: #09090b;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 24px;
    transition: opacity .5s ease, visibility .5s ease;
}

.preloader.done {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.preloader-bar-track {
    width: 200px;
    height: 3px;
    background: #27272a;
    border-radius: 2px;
    overflow: hidden;
}

.preloader-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #6366f1, #22d3ee);
    border-radius: 2px;
    animation: preloaderFill 1.2s cubic-bezier(.16,1,.3,1) forwards;
}

.preloader-brand {
    font-family: 'Inter', sans-serif;
    font-size: 16px;
    font-weight: 700;
    color: #fafafa;
    letter-spacing: -.3px;
    opacity: 0;
    animation: fadeUp .5s .1s ease forwards;
}

@keyframes preloaderFill {
    0% { width: 0%; }
    60% { width: 85%; }
    100% { width: 100%; }
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ── FULLSCREEN OVERLAY MENU ── */
.menu-toggle {
    display: flex;
    background: none;
    border: 1px solid #27272a;
    border-radius: 6px;
    padding: 6px 10px;
    cursor: pointer;
    z-index: 10002;
    position: relative;
    flex-direction: column;
    gap: 4px;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 36px;
    transition: border-color .3s ease, background .3s ease;
}

.menu-toggle:hover {
    border-color: #3f3f46;
    background: rgba(255,255,255,.05);
}

.menu-toggle span {
    display: block;
    width: 18px;
    height: 2px;
    background: #fafafa;
    border-radius: 1px;
    transition: transform .3s ease, opacity .2s ease;
}

.menu-toggle.active span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.menu-toggle.active span:nth-child(2) { opacity: 0; }
.menu-toggle.active span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

.overlay-menu {
    position: fixed;
    inset: 0;
    z-index: 10001;
    background: rgba(9,9,11,.97);
    backdrop-filter: blur(30px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity .4s cubic-bezier(.16,1,.3,1), visibility .4s;
}

.overlay-menu.open {
    opacity: 1;
    visibility: visible;
}

.overlay-menu nav {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.overlay-menu nav a {
    font-family: 'Inter', sans-serif;
    font-size: 28px;
    font-weight: 700;
    color: #71717a;
    text-decoration: none;
    padding: 12px 24px;
    border-radius: 8px;
    transition: color .25s ease, transform .3s cubic-bezier(.16,1,.3,1), letter-spacing .3s ease;
    opacity: 0;
    transform: translateY(20px);
}

.overlay-menu.open nav a {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger entrance */
.overlay-menu.open nav a:nth-child(1) { transition-delay: .05s; }
.overlay-menu.open nav a:nth-child(2) { transition-delay: .08s; }
.overlay-menu.open nav a:nth-child(3) { transition-delay: .11s; }
.overlay-menu.open nav a:nth-child(4) { transition-delay: .14s; }
.overlay-menu.open nav a:nth-child(5) { transition-delay: .17s; }
.overlay-menu.open nav a:nth-child(6) { transition-delay: .20s; }
.overlay-menu.open nav a:nth-child(7) { transition-delay: .23s; }
.overlay-menu.open nav a:nth-child(8) { transition-delay: .26s; }

.overlay-menu nav a:hover {
    color: #fafafa;
    letter-spacing: 2px;
}

.overlay-menu nav a.active {
    color: #6366f1;
}

/* ── PAGE TRANSITION OVERLAY ── */
.page-transition {
    position: fixed;
    inset: 0;
    z-index: 99998;
    background: #09090b;
    transform: translateY(100%);
    transition: transform .5s cubic-bezier(.76,0,.24,1);
    pointer-events: none;
}

.page-transition.entering {
    transform: translateY(0);
}

/* ── 3D CANVAS BACKGROUND ── */
#particle-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
    opacity: .4;
}

/* ── MAGNETIC CURSOR ── */
.magnetic {
    transition: transform .3s cubic-bezier(.16,1,.3,1);
}

/* ── BENTO GRID ── */
.bento-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: minmax(140px, auto);
    gap: 16px;
    margin-bottom: 48px;
}

.bento-item {
    background: #18181b;
    border: 1px solid #27272a;
    border-radius: 12px;
    padding: 28px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform .4s cubic-bezier(.16,1,.3,1), border-color .3s ease, box-shadow .4s ease;
    overflow: hidden;
    position: relative;
}

.bento-item:hover {
    transform: translateY(-4px) scale(1.01);
    border-color: #3f3f46;
    box-shadow: 0 12px 40px rgba(0,0,0,.35);
}

.bento-item.span-2 { grid-column: span 2; }
.bento-item.span-3 { grid-column: span 3; }
.bento-item.row-2 { grid-row: span 2; }

.bento-item .bento-label {
    font-size: 11px;
    font-weight: 600;
    color: #6366f1;
    text-transform: uppercase;
    letter-spacing: .8px;
    margin-bottom: 8px;
}

.bento-item .bento-title {
    font-size: 20px;
    font-weight: 800;
    color: #fafafa;
    letter-spacing: -.3px;
    margin-bottom: 8px;
}

.bento-item .bento-desc {
    font-size: 13px;
    color: #71717a;
    line-height: 1.6;
}

.bento-item .bento-stat {
    font-size: 42px;
    font-weight: 900;
    color: #fafafa;
    letter-spacing: -2px;
    line-height: 1;
}

.bento-item .bento-stat-label {
    font-size: 12px;
    color: #71717a;
    margin-top: 6px;
    text-transform: uppercase;
    letter-spacing: .5px;
}

.bento-item .bento-glow {
    position: absolute;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    filter: blur(80px);
    opacity: .12;
    pointer-events: none;
}

/* ── PROCESS TRACKER / TIMELINE ── */
.process-tracker {
    margin-bottom: 48px;
    padding: 48px 0;
    border-top: 1px solid #27272a;
}

.process-tracker-title {
    font-size: 16px;
    font-weight: 700;
    color: #fafafa;
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-bottom: 32px;
    text-align: center;
}

.process-steps {
    display: flex;
    gap: 0;
    position: relative;
    max-width: 900px;
    margin: 0 auto;
}

.process-step {
    flex: 1;
    text-align: center;
    padding: 0 16px;
    position: relative;
    cursor: pointer;
}

.process-step::before {
    content: '';
    position: absolute;
    top: 18px;
    left: 50%;
    right: -50%;
    height: 2px;
    background: #27272a;
    z-index: 0;
}

.process-step:last-child::before { display: none; }

.step-number {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #18181b;
    border: 2px solid #27272a;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
    font-size: 13px;
    font-weight: 700;
    color: #71717a;
    position: relative;
    z-index: 1;
    transition: all .35s cubic-bezier(.16,1,.3,1);
}

.process-step.active .step-number,
.process-step:hover .step-number {
    background: #6366f1;
    border-color: #6366f1;
    color: #fff;
    box-shadow: 0 0 20px rgba(99,102,241,.3);
    transform: scale(1.15);
}

.step-title {
    font-size: 13px;
    font-weight: 700;
    color: #a1a1aa;
    margin-bottom: 4px;
    transition: color .25s ease;
}

.process-step.active .step-title,
.process-step:hover .step-title { color: #fafafa; }

.step-desc {
    font-size: 12px;
    color: #71717a;
    line-height: 1.5;
    max-height: 0;
    overflow: hidden;
    transition: max-height .4s cubic-bezier(.16,1,.3,1), opacity .3s ease;
    opacity: 0;
}

.process-step.active .step-desc {
    max-height: 100px;
    opacity: 1;
}

/* ── MASK REVEAL / KINETIC TYPOGRAPHY ── */
.mask-reveal {
    overflow: hidden;
    display: inline-block;
}

.mask-reveal > * {
    display: block;
    transform: translateY(110%);
    transition: transform .8s cubic-bezier(.16,1,.3,1);
}

.mask-reveal.revealed > * {
    transform: translateY(0);
}

/* ── PARALLAX WRAPPER ── */
[data-parallax] {
    will-change: transform;
    transition: transform .1s linear;
}

/* ── SMOOTH BODY FOR LENIS ── */
html.lenis, html.lenis body {
    height: auto;
}

.lenis.lenis-smooth {
    scroll-behavior: auto !important;
}

.lenis.lenis-smooth [data-lenis-prevent] {
    overscroll-behavior: contain;
}

/* ── RESPONSIVE OVERRIDES ── */
@media (max-width: 1024px) {
    .bento-grid { grid-template-columns: repeat(2, 1fr); }
    .bento-item.span-3 { grid-column: span 2; }
    .process-steps { flex-direction: column; gap: 8px; }
    .process-step::before { display: none; }
    .step-desc { max-height: none; opacity: 1; }
}

@media (max-width: 768px) {
    .bento-grid { grid-template-columns: 1fr; }
    .bento-item.span-2, .bento-item.span-3 { grid-column: span 1; }
    .header .menu { display: none; }
}
