/* ============================================
   PORTFOLIO - HERO SECTION
   Module 4: Heavily animated hero
   Loaded only on the home page.
   ============================================ */

/* ----------------------------------------
   1. ENTRANCE SYSTEM (runs after preloader)
   ---------------------------------------- */
.js .hero-load-item {
    opacity: 0;
    transform: translateY(26px);
}

.js.page-loaded .hero-load-item {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.8s var(--ease-out), transform 0.8s var(--ease-out);
}

.js.page-loaded .hero-load-item.d1 { transition-delay: 0.15s; }
.js.page-loaded .hero-load-item.d2 { transition-delay: 0.3s; }
.js.page-loaded .hero-load-item.d3 { transition-delay: 0.45s; }
.js.page-loaded .hero-load-item.d4 { transition-delay: 0.6s; }
.js.page-loaded .hero-load-item.d5 { transition-delay: 0.75s; }
.js.page-loaded .hero-load-item.d6 { transition-delay: 0.9s; }

/* ----------------------------------------
   2. CHARACTER SPLIT NAME REVEAL
   ---------------------------------------- */
[data-split="chars"] .char {
    display: inline-block;
    overflow: hidden;
    vertical-align: bottom;
}

[data-split="chars"] .char-space {
    width: 0.32em;
    overflow: visible;
}

[data-split="chars"] .char-inner {
    display: inline-block;
    transform: translateY(115%);
    transition: transform 0.7s var(--ease-out);
    will-change: transform;
}

.js.page-loaded [data-split="chars"] .char-inner {
    transform: translateY(0);
}

/* ----------------------------------------
   3. HERO BACKGROUND EXTRA LAYERS
   ---------------------------------------- */
.hero-section {
    overflow: hidden;
}

.hero-particles {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

.hero-particle {
    position: absolute;
    display: block;
    border-radius: var(--radius-round);
    background: var(--primary-light);
    opacity: 0.14;
    animation: particleDrift var(--dur, 8s) ease-in-out infinite alternate;
    will-change: transform, opacity;
}

@keyframes particleDrift {
    0%   { transform: translate(0, 0); opacity: 0.08; }
    50%  { opacity: 0.22; }
    100% { transform: translate(var(--dx, 12px), var(--dy, -18px)); opacity: 0.05; }
}

.hero-beam {
    position: absolute;
    left: 10%;
    right: 10%;
    bottom: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--primary), var(--secondary), transparent);
    background-size: 220% 100%;
    animation: gradientFlow 6s ease-in-out infinite;
    opacity: 0.6;
    filter: blur(0.5px);
}

/* ----------------------------------------
   4. HERO VISUAL COMPOSITION
   ---------------------------------------- */
.hero-visual {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 480px;
}

.hero-image-wrap {
    position: relative;
    z-index: 1;
}

/* Rotating gradient ring behind the frame */
.hero-image-ring {
    position: relative;
    width: 360px;
    height: 360px;
    border-radius: var(--radius-2xl);
    filter: drop-shadow(0 20px 60px rgba(0, 0, 0, 0.45));
}

.hero-image-ring::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: var(--radius-2xl);
    background: conic-gradient(from 0deg, var(--primary), var(--secondary), var(--accent), var(--primary));
    animation: rotate 9s linear infinite;
}

.hero-image-ring::after {
    content: '';
    position: absolute;
    inset: 6px;
    border-radius: calc(var(--radius-2xl) - 6px);
    background: var(--bg-primary);
}

/* The actual frame sits inside the ring */
.hero-image-frame {
    position: absolute;
    inset: 12px;
    width: auto;
    height: auto;
    border-radius: var(--radius-xl);
    overflow: hidden;
    border: var(--border-width-thick) solid rgba(255, 255, 255, 0.06);
    box-shadow: none;
    z-index: 1;
}

.hero-image-frame .hero-image-placeholder {
    width: 100%;
    height: 100%;
    background:
        radial-gradient(ellipse at 30% 20%, rgba(var(--primary-rgb), 0.35), transparent 55%),
        radial-gradient(ellipse at 70% 80%, rgba(var(--secondary-rgb), 0.3), transparent 55%),
        var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--fs-3xl);
    color: var(--primary-light);
}

.hero-image-ring::before,
.hero-image-ring::after,
.hero-image-frame {
    border-radius: var(--radius-xl);
}

/* ----------------------------------------
   5. FLOATING TECH ICONS
   ---------------------------------------- */
.tech-float {
    position: absolute;
    z-index: 2;
    width: 54px;
    height: 54px;
    border-radius: 16px;
    background: var(--bg-card);
    border: var(--border-width) solid var(--surface-border-strong);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--text-primary);
    box-shadow: var(--shadow-md);
    will-change: transform;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.tech-html { top: 6%;   left: 4%;   color: #e44d26; animation: floatSlow 7s ease-in-out infinite; }
.tech-css  { top: 24%;  right: 0;   color: #264de4; animation: float 8s ease-in-out infinite; }
.tech-js   { bottom: 28%; right: 2%; color: #f0db4f; animation: floatReverse 6s ease-in-out infinite; }
.tech-php  { bottom: 4%; left: 0;   color: #8892be; animation: float 6.5s ease-in-out infinite; }
.tech-db   { top: 0;    right: 22%; color: var(--secondary); animation: floatX 7.5s ease-in-out infinite; }
.tech-bs   { bottom: -2%; right: 30%; color: #7952b3; animation: floatReverse 8.5s ease-in-out infinite; }

.tech-float:hover {
    color: var(--primary-light);
    border-color: var(--primary);
    box-shadow: var(--shadow-glow);
    transform: scale(1.12);
}

/* ----------------------------------------
   6. FLOATING STAT BADGES
   ---------------------------------------- */
.hero-badge {
    position: absolute;
    z-index: 3;
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: 0.7rem 1.1rem;
    background: rgba(255, 255, 255, 0.06);
    border: var(--border-width) solid var(--surface-border-strong);
    border-radius: var(--radius-md);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: var(--shadow-md);
    white-space: nowrap;
}

.hero-badge strong {
    font-family: var(--font-mono);
    font-size: var(--fs-xl);
    font-weight: var(--fw-bold);
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-badge span {
    font-size: var(--fs-xs);
    color: var(--text-secondary);
    line-height: 1.3;
    letter-spacing: var(--ls-wide);
    text-transform: uppercase;
}

.hero-badge-exp { top: 16%;    right: 2%; }
.hero-badge-projects { bottom: 30%; left: 0; }

/* ----------------------------------------
   7. FLOATING CODE WINDOW
   ---------------------------------------- */
.hero-code-window {
    position: absolute;
    z-index: 3;
    bottom: 2%;
    left: -4%;
    width: 250px;
    box-shadow: var(--shadow-lg);
    will-change: transform;
}

.hero-code-window .code-window-body {
    padding: var(--space-4);
    font-size: var(--fs-xs);
    line-height: 1.8;
}

/* ----------------------------------------
   8. SCROLL INDICATOR
   ---------------------------------------- */
.scroll-indicator i.bi-chevron-down {
    color: var(--primary-light);
    font-size: var(--fs-lg);
    animation: bounceDown 1.6s ease-in-out infinite;
    margin-top: -4px;
}

/* ----------------------------------------
   9. RESPONSIVE
   ---------------------------------------- */
@media (max-width: 1199.98px) {
    .hero-image-ring {
        width: 320px;
        height: 320px;
    }

    .hero-code-window {
        left: -2%;
        width: 220px;
    }
}

@media (max-width: 991.98px) {
    .hero-visual {
        min-height: 0;
        margin-top: var(--space-4);
    }

    .hero-image-ring {
        width: 280px;
        height: 280px;
    }

    .tech-html { left: 2%; }
    .tech-css  { right: -2%; }
    .hero-badge-projects { left: 2%; }

    .hero-code-window {
        left: 50%;
        transform: translateX(-50%);
        bottom: -4%;
        width: 220px;
    }
}

@media (max-width: 575.98px) {
    .hero-section .min-vh-100 {
        min-height: auto;
    }

    .hero-visual {
        min-height: 0;
        margin-top: var(--space-3);
    }

    .hero-image-ring {
        width: 210px;
        height: 210px;
    }

    .hero-image-placeholder {
        font-size: var(--fs-xl);
    }

    /* Declutter small screens: keep 2 icon badges, drop the code window */
    .tech-html, .tech-css {
        width: 42px;
        height: 42px;
        font-size: 1.15rem;
    }

    .tech-js, .tech-php, .tech-db, .tech-bs,
    .hero-badge-exp, .hero-badge-projects,
    .hero-code-window {
        display: none;
    }

    .hero-visual {
        flex-direction: column;
    }
}

/* ----------------------------------------
   10. REDUCED MOTION
   ---------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    .hero-image-ring::before {
        animation: none;
    }

    .tech-float,
    .hero-badge,
    .hero-code-window {
        animation: none !important;
    }

    .hero-particle {
        display: none;
    }

    .hero-beam {
        animation: none;
    }

    .hero-name[data-split="chars"] .char-inner,
    [data-split="chars"] .char-inner {
        transform: none;
        transition: none;
    }
}