/* ==============================================================
   endanesia.com - Interactive Avatar & Floating Articles Styles
   Author: Enda Setiyo
   Design: Modern Cyber-Glassmorphism, High Performance 60fps
   ============================================================== */

:root {
    --bg-dark: #070913;
    --bg-card: rgba(13, 18, 36, 0.88);
    --border-card: rgba(99, 102, 241, 0.55);
    --border-card-hover: #38bdf8;
    --glow-cyan: rgba(56, 189, 248, 0.35);
    --glow-indigo: rgba(99, 102, 241, 0.45);
    --text-primary: #ffffff;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --accent-indigo: #6366f1;
    --accent-cyan: #38bdf8;
    --accent-purple: #a855f7;
    --font-heading: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
}

/* Base resets & smooth rendering */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: var(--font-heading);
    overflow-x: hidden;
    position: relative;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Ambient dynamic background lighting */
.scene-workspace-bg {
    position: fixed;
    inset: 0;
    background-image: url('../images/workspace-bg.jpg');
    background-size: cover;
    background-position: center bottom;
    background-repeat: no-repeat;
    opacity: 0.42;
    filter: brightness(0.68) contrast(1.08);
    pointer-events: none;
    z-index: 0;
    transition: opacity 0.5s ease;
}

.ambient-glow-1 {
    position: fixed;
    top: -20%;
    left: -10%;
    width: 60vw;
    height: 60vw;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.15) 0%, rgba(0, 0, 0, 0) 70%);
    filter: blur(80px);
    pointer-events: none;
    z-index: 0;
}

.ambient-glow-2 {
    position: fixed;
    bottom: -20%;
    right: -10%;
    width: 65vw;
    height: 65vw;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(56, 189, 248, 0.12) 0%, rgba(0, 0, 0, 0) 70%);
    filter: blur(90px);
    pointer-events: none;
    z-index: 0;
}

/* Grid overlay pattern */
.grid-bg-overlay {
    position: fixed;
    inset: 0;
    background-image: 
        linear-gradient(to right, rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: radial-gradient(ellipse at center, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0) 80%);
    pointer-events: none;
    z-index: 1;
}

/* Main interactive stage container */
.stage-container {
    position: relative;
    width: 100%;
    height: 100vh;
    min-height: 700px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

/* Central Avatar Wrapper */
.avatar-wrapper {
    position: absolute;
    top: 52%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(760px, 62vw);
    height: min(680px, 72vh);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    z-index: 15;
    user-select: none;
}

/* Aura behind avatar */
.avatar-aura {
    position: absolute;
    width: 120%;
    height: 120%;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.28) 0%, rgba(56, 189, 248, 0.12) 40%, transparent 70%);
    border-radius: 50%;
    filter: blur(40px);
    z-index: 1;
    pointer-events: none;
    animation: auraPulse 6s ease-in-out infinite alternate;
}

@keyframes auraPulse {
    0% { transform: scale(0.92); opacity: 0.6; }
    100% { transform: scale(1.08); opacity: 0.95; }
}

/* Avatar Frame holding all 6 images */
.avatar-frame {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.avatar-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center bottom;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s cubic-bezier(0.2, 0.8, 0.3, 1);
    will-change: opacity, transform;
    filter: drop-shadow(0 15px 35px rgba(0, 0, 0, 0.5));
}

.avatar-layer.active {
    opacity: 1;
    pointer-events: auto;
}

/* Nameplate badge below avatar */
.avatar-nameplate {
    position: absolute;
    bottom: -15px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(13, 18, 36, 0.92);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1.5px solid rgba(99, 102, 241, 0.55);
    border-radius: 9999px;
    padding: 7px 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.6), 0 0 15px rgba(99, 102, 241, 0.25);
    z-index: 25;
    white-space: nowrap;
}

.avatar-status-dot {
    width: 8px;
    height: 8px;
    background-color: #10b981;
    border-radius: 50%;
    box-shadow: 0 0 10px #10b981;
    animation: dotPulse 2s infinite;
}

@keyframes dotPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.85); }
}

/* ==============================================================
   7 Floating Article Cards Layout & Keyframe Physics
   ============================================================== */

.articles-canvas {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 25;
}

.article-card-wrapper {
    position: absolute;
    pointer-events: auto;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), 
                opacity 0.35s ease, 
                filter 0.35s ease;
    will-change: transform, opacity, filter;
    z-index: 10;
}

/* Organic Floating Animations */
@keyframes floatBobA {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-12px) rotate(0.4deg); }
}

@keyframes floatBobB {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-16px) rotate(-0.5deg); }
}

@keyframes floatBobC {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-10px) rotate(0.3deg); }
}

.article-card {
    display: block;
    text-decoration: none;
    background: var(--bg-card);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1.5px solid var(--border-card);
    border-radius: 18px;
    padding: 16px 20px;
    width: 320px;
    box-shadow: 0 15px 35px -8px rgba(0, 0, 0, 0.7), 
                0 0 18px rgba(99, 102, 241, 0.22),
                inset 0 1px 1px rgba(255, 255, 255, 0.25);
    color: var(--text-primary);
    position: relative;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* Subtle top glow highlight on each card */
.article-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 10%;
    right: 10%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(56, 189, 248, 0.8), rgba(99, 102, 241, 0.8), transparent);
    pointer-events: none;
}

/* Floating bobbing assignment */
.article-card-wrapper:nth-child(odd) .article-card {
    animation: floatBobA 5.5s ease-in-out infinite;
}
.article-card-wrapper:nth-child(even) .article-card {
    animation: floatBobB 6.5s ease-in-out infinite;
}
.article-card-wrapper:nth-child(3n) .article-card {
    animation: floatBobC 7.2s ease-in-out infinite;
}

/* Card Header: Category & Read Time */
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.card-category {
    padding: 3px 10px;
    border-radius: 9999px;
    background: rgba(99, 102, 241, 0.24);
    color: #c7d2fe;
    border: 1px solid rgba(99, 102, 241, 0.5);
    font-weight: 700;
}

.card-read-time {
    color: var(--text-muted);
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Card Title with 25-30 char truncation preview */
.card-title {
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.4;
    color: var(--text-primary);
    margin: 0 0 8px 0;
    transition: color 0.25s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 280px;
}

/* Card Excerpt (hidden by default, expands on hover) */
.card-excerpt {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.45;
    margin: 0;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0, 1, 0, 1), opacity 0.3s ease, margin 0.3s ease;
}

/* Card Footer */
.card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 6px;
    font-size: 0.72rem;
    color: var(--text-muted);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding-top: 8px;
}

.card-action {
    display: flex;
    align-items: center;
    gap: 4px;
    color: var(--accent-cyan);
    font-weight: 500;
    opacity: 0.85;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.article-card:hover .card-action {
    opacity: 1;
    transform: translateX(3px);
}

/* ==============================================================
   7 Explicit Floating Positions Around the Center Avatar
   ============================================================== */

/* 1. Top Center (Gaze: look-up) */
.pos-top {
    top: 5%;
    left: 50%;
    transform: translateX(-50%);
}

/* 2. Top Left (Gaze: look-top-left) */
.pos-top-left {
    top: 12%;
    left: 5%;
}

/* 3. Mid Left (Gaze: look-left) */
.pos-mid-left {
    top: 40%;
    left: 3%;
}

/* 4. Bottom Left (Gaze: look-left) */
.pos-bottom-left {
    top: 70%;
    left: 5%;
}

/* 5. Top Right (Gaze: look-top-right) */
.pos-top-right {
    top: 12%;
    right: 5%;
}

/* 6. Mid Right (Gaze: look-right) */
.pos-mid-right {
    top: 40%;
    right: 3%;
}

/* 7. Bottom Right (Gaze: look-right) */
.pos-bottom-right {
    top: 70%;
    right: 6%;
}

/* ==============================================================
   Hover & Focus Mechanics (Specification Section 4.B)
   - Hovered article: scale(1.15), remove text-truncation, z-index: 50
   - Sibling articles: scale(0.85), opacity: 0.5, filter: blur(1.5px)
   ============================================================== */

/* Hovered state on active article */
.article-card-wrapper.is-hovered {
    z-index: 50 !important;
    transform: scale(1.15) !important;
}

.article-card-wrapper.is-hovered .article-card {
    border-color: var(--border-card-hover);
    border-width: 2px;
    box-shadow: 0 22px 50px -10px rgba(0, 0, 0, 0.85), 
                0 0 32px rgba(56, 189, 248, 0.55),
                0 0 16px rgba(99, 102, 241, 0.65),
                inset 0 1px 2px rgba(255, 255, 255, 0.4);
    background: rgba(18, 26, 52, 0.96);
    animation-play-state: paused;
}

.article-card-wrapper.is-hovered .card-title {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    color: #ffffff;
}

.article-card-wrapper.is-hovered .card-excerpt {
    max-height: 80px;
    opacity: 1;
    margin-top: 6px;
    margin-bottom: 8px;
}

/* Sibling state when another card is hovered */
.article-card-wrapper.is-dimmed {
    transform: scale(0.85) !important;
    opacity: 0.48 !important;
    filter: blur(1.5px) !important;
    pointer-events: none;
}

/* ==============================================================
   Bottom Right Fixed "More Articles" Button
   ============================================================== */

.btn-more-articles {
    position: fixed;
    bottom: 28px;
    right: 32px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 13px 24px;
    background: rgba(16, 21, 38, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 9999px;
    color: var(--text-primary);
    font-size: 0.92rem;
    font-weight: 600;
    text-decoration: none;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 
                0 0 20px rgba(99, 102, 241, 0.25);
    z-index: 100;
    transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.btn-more-articles:hover {
    transform: translateY(-3px) scale(1.05);
    border-color: rgba(99, 102, 241, 0.7);
    box-shadow: 0 15px 35px -5px rgba(99, 102, 241, 0.4), 
                0 0 30px rgba(56, 189, 248, 0.35);
    background: rgba(26, 33, 61, 0.95);
    color: #ffffff;
}

.btn-more-articles .btn-icon-wrapper {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-indigo), var(--accent-cyan));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.8rem;
    transition: transform 0.3s ease;
}

.btn-more-articles:hover .btn-icon-wrapper {
    transform: rotate(45deg);
}

/* ==============================================================
   Site Header / Navigation
   ============================================================== */

.site-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    padding: 18px 36px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 100;
    background: linear-gradient(180deg, rgba(7, 9, 19, 0.85) 0%, rgba(7, 9, 19, 0) 100%);
    pointer-events: none;
}

.site-nav * {
    pointer-events: auto;
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: white;
}

.brand-flag {
    width: 36px;
    height: 24px;
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.22);
    flex-shrink: 0;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.brand-logo:hover .brand-flag {
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(225, 29, 72, 0.35), 0 0 0 1.5px rgba(255, 255, 255, 0.4);
}

.brand-flag-red {
    height: 50%;
    width: 100%;
    background: #e11d48;
}

.brand-flag-white {
    height: 50%;
    width: 100%;
    background: #ffffff;
}

.brand-text h1 {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin: 0;
    background: linear-gradient(135deg, #ffffff 40%, #94a3b8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand-text span {
    display: block;
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 500;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 16px;
}

.nav-item {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 500;
    padding: 6px 14px;
    border-radius: 9999px;
    transition: color 0.2s ease, background 0.2s ease;
}

.nav-item:hover {
    color: white;
    background: rgba(255, 255, 255, 0.06);
}

/* ==============================================================
   Footer / Status Bar
   ============================================================== */

.site-footer {
    position: fixed;
    bottom: 24px;
    left: 36px;
    z-index: 100;
    pointer-events: none;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.site-footer span {
    color: var(--text-secondary);
}

/* Hint Pill in middle bottom */
.stage-hint {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 9999px;
    padding: 6px 16px;
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
    pointer-events: none;
    z-index: 90;
    animation: fadeInOut 4s infinite alternate ease-in-out;
}

@keyframes fadeInOut {
    0% { opacity: 0.4; }
    100% { opacity: 0.9; }
}

/* ==============================================================
   Responsive Fallbacks (Mobile & Tablet)
   ============================================================== */

@media (max-width: 1200px) {
    .article-card {
        width: 270px;
        padding: 13px 16px;
    }
    .card-title {
        max-width: 230px;
        font-size: 0.88rem;
    }
    .pos-top-left { left: 4%; }
    .pos-mid-left { left: 2%; }
    .pos-bottom-left { left: 5%; }
    .pos-top-right { right: 4%; }
    .pos-mid-right { right: 2%; }
    .pos-bottom-right { right: 7%; }
}

@media (max-width: 900px) {
    .stage-container {
        height: auto;
        min-height: 100vh;
        overflow-y: auto;
        display: block;
        padding-top: 90px;
        padding-bottom: 90px;
    }
    
    .avatar-wrapper {
        position: relative;
        top: auto;
        left: auto;
        transform: none;
        margin: 0 auto 30px auto;
        width: 260px;
        height: 320px;
    }

    .articles-canvas {
        position: relative;
        inset: auto;
        pointer-events: auto;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 16px;
        padding: 0 20px;
        width: 100%;
        max-width: 600px;
        margin: 0 auto;
    }

    .article-card-wrapper {
        position: relative !important;
        top: auto !important;
        left: auto !important;
        right: auto !important;
        bottom: auto !important;
        transform: none !important;
        width: 100%;
    }

    .article-card {
        width: 100%;
        animation: none !important;
    }

    .card-title {
        white-space: normal;
        max-width: 100%;
    }

    .stage-hint {
        display: none;
    }

    .site-footer {
        position: static;
        text-align: center;
        margin-top: 40px;
        padding-bottom: 20px;
        pointer-events: auto;
    }

    .btn-more-articles {
        bottom: 16px;
        right: 16px;
        padding: 10px 18px;
        font-size: 0.84rem;
    }
}
