/* ============================================================
   AcessAI Visual Effects — Preloader, 3D Carousel, Scroll Animations
   ============================================================ */

/* --------------------------------------------------
   1. PRELOADER
   -------------------------------------------------- */
#preloader {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: linear-gradient(135deg, #357abd 0%, #1a4f8a 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 0.6s ease, visibility 0.6s ease;
}

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

.preloader-logo {
    font-size: 3.5rem;
    font-weight: 900;
    color: #fff;
    letter-spacing: 2px;
    margin-bottom: 2rem;
    animation: preloader-pulse 1.4s ease-in-out infinite;
}

@keyframes preloader-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: 0.7; transform: scale(0.97); }
}

.preloader-ring {
    width: 56px;
    height: 56px;
    border: 5px solid rgba(255, 255, 255, 0.25);
    border-top-color: #fff;
    border-radius: 50%;
    animation: preloader-spin 0.85s linear infinite;
}

@keyframes preloader-spin {
    to { transform: rotate(360deg); }
}

.preloader-tagline {
    margin-top: 1.4rem;
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.95rem;
    letter-spacing: 0.5px;
}

/* --------------------------------------------------
   2. 3D CAROUSEL (Blog Preview)
   -------------------------------------------------- */
.carousel-scene {
    perspective: 900px;
    width: 100%;
    max-width: 380px;
    margin: 0 auto;
    height: 420px;
    position: relative;
}

.carousel-stage {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.75s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.carousel-cell {
    position: absolute;
    width: 320px;
    left: 50%;
    transform: translateX(-50%);
    top: 0;
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 12px 40px rgba(53, 122, 189, 0.18);
    overflow: hidden;
    backface-visibility: hidden;
    transition: transform 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                opacity 0.7s ease;
}

.carousel-cell img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    display: block;
}

.carousel-cell-body {
    padding: 1.2rem 1.4rem 1.4rem;
}

.carousel-cell-body h3 {
    font-size: 1.05rem;
    font-weight: 700;
    color: #1a4f8a;
    margin-bottom: 0.5rem;
}

.carousel-cell-body p {
    font-size: 0.88rem;
    color: #555;
    line-height: 1.5;
    margin-bottom: 1rem;
}

.carousel-cell-body .carousel-link {
    display: inline-block;
    padding: 0.45rem 1.1rem;
    background: #357abd;
    color: #fff;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.2s ease, transform 0.2s ease;
}

.carousel-cell-body .carousel-link:hover,
.carousel-cell-body .carousel-link:focus {
    background: #1a4f8a;
    transform: translateY(-1px);
}

/* Carousel controls */
.carousel-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-top: 1.5rem;
}

.carousel-btn {
    background: #357abd;
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 42px;
    height: 42px;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, transform 0.15s ease;
    box-shadow: 0 4px 12px rgba(53, 122, 189, 0.3);
}

.carousel-btn:hover,
.carousel-btn:focus {
    background: #1a4f8a;
    transform: scale(1.1);
    outline: 2px solid #fff;
}

.carousel-dots {
    display: flex;
    gap: 8px;
}

.carousel-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #cde;
    border: none;
    cursor: pointer;
    transition: background 0.25s ease, transform 0.2s ease;
    padding: 0;
}

.carousel-dot.active {
    background: #357abd;
    transform: scale(1.3);
}

/* Carousel wrapper (replaces the plain blog-container in the preview section) */
.carousel-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem 0 2rem;
}

/* --------------------------------------------------
   2.5 ABOUT ME CARD (Home)
   -------------------------------------------------- */
.about-me-card {
    display: grid;
    grid-template-columns: minmax(240px, 330px) 1fr;
    gap: 1.5rem;
    align-items: stretch;
    background: linear-gradient(150deg, rgba(17, 25, 40, 0.94), rgba(20, 40, 72, 0.88));
    color: #eef6ff;
    border-radius: 24px;
    padding: 1.25rem;
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: 0 12px 34px rgba(10, 20, 35, 0.28);
}

.about-me-media {
    border-radius: 16px;
    overflow: hidden;
    min-height: 260px;
    background: #111;
}

.about-me-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 76%;
    display: block;
}

.about-me-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.85rem;
}

.about-me-content p {
    margin: 0;
    line-height: 1.65;
    color: #e3ecf8;
}

.about-me-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-top: 0.35rem;
}

.about-tag {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.8rem;
    border-radius: 999px;
    border: 1px solid rgba(148, 199, 255, 0.36);
    background: rgba(95, 174, 255, 0.12);
    color: #d9ecff;
    font-size: 0.86rem;
    font-weight: 600;
}

/* --------------------------------------------------
   3. SCROLL-TRIGGERED MOTION ANIMATIONS
   -------------------------------------------------- */

/* Base hidden state – items start invisible/shifted */
.reveal {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.65s ease, transform 0.65s ease;
}

.reveal.reveal-left {
    transform: translateX(-50px);
}

.reveal.reveal-right {
    transform: translateX(50px);
}

.reveal.reveal-scale {
    transform: scale(0.88);
}

/* Visible state */
.reveal.is-visible {
    opacity: 1;
    transform: none;
}

/* Staggered delays for grid children */
.reveal-stagger > *:nth-child(1) { transition-delay: 0.05s; }
.reveal-stagger > *:nth-child(2) { transition-delay: 0.15s; }
.reveal-stagger > *:nth-child(3) { transition-delay: 0.25s; }
.reveal-stagger > *:nth-child(4) { transition-delay: 0.35s; }
.reveal-stagger > *:nth-child(5) { transition-delay: 0.45s; }
.reveal-stagger > *:nth-child(6) { transition-delay: 0.55s; }

/* Section header special entrance */
.section-header.reveal {
    transform: translateY(24px);
}

/* --------------------------------------------------
   4. FLOATING PARTICLES BACKGROUND (Hero)
   -------------------------------------------------- */
.hero-particles {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 1;
}

.hero-particles span {
    position: absolute;
    bottom: -20px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.45);
    animation: particle-rise var(--dur, 6s) linear var(--delay, 0s) infinite;
    opacity: 0;
    will-change: transform, opacity;
}

@keyframes particle-rise {
    0%   { transform: translateY(0) scale(1); opacity: 0; }
    10%  { opacity: 1; }
    90%  { opacity: 0.6; }
    100% { transform: translateY(-720px) scale(0.4); opacity: 0; }
}

/* --------------------------------------------------
   5. COUNTER ANIMATION (Stats)
   -------------------------------------------------- */
.stat-number[data-target] {
    display: inline-block;
}

/* --------------------------------------------------
   6. RESPECT REDUCED MOTION
   -------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    .preloader-ring,
    .preloader-logo,
    .hero-particles span,
    .carousel-stage,
    .reveal,
    .reveal.reveal-left,
    .reveal.reveal-right,
    .reveal.reveal-scale {
        animation: none !important;
        transition: none !important;
        transform: none !important;
        opacity: 1 !important;
    }

    .reveal.is-visible {
        opacity: 1;
        transform: none;
    }
}

@media (max-width: 900px) {
    .about-me-card {
        grid-template-columns: 1fr;
    }

    .about-me-media {
        min-height: 220px;
        max-height: 300px;
    }
}
