/* ==========================================================================
   FUTURISTIC 3D DESIGN SYSTEM & VARIABLES
   ========================================================================== */
:root {
    --color-bg: #FFEBD3;
    --color-bg-alt: #fdf5eb;
    --color-surface: rgba(255, 255, 255, 0.45);
    
    /* Neon glow colors adjusted for light contrast */
    --color-green: #008a3d;
    --color-cyan: #008096;
    --color-red: #c20037;
    --color-yellow: #ca8a04;
    --color-purple: #7c3aed;
    
    --color-text-main: #1c1917;
    --color-text-muted: #57534e;
    --color-border: rgba(28, 25, 23, 0.08);
    
    --radius-lg: 28px;
    --radius-md: 18px;
    --radius-sm: 12px;
    --radius-pill: 9999px;
    
    --transition-smooth: all 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    --transition-bounce: all 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ==========================================================================
   RESET & BASE STYLES
   ========================================================================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
    background-color: var(--color-bg);
    overflow-x: hidden;
}

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    color: var(--color-text-main);
    background-color: var(--color-bg);
    overflow-x: hidden;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    perspective: 1200px; /* Base 3D Perspective of the viewport */
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('../images/hanoi_2030_cover.png');
    background-size: cover;
    background-position: center;
    opacity: 0.12; /* Subtle watermark blending */
    z-index: -3;
    pointer-events: none;
    filter: sepia(12%) contrast(0.95);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: var(--color-bg);
}
::-webkit-scrollbar-thumb {
    background: #dfd2c4;
    border-radius: var(--radius-pill);
}
::-webkit-scrollbar-thumb:hover {
    background: #cbbba8;
}

/* ==========================================================================
   3D FLOATING BACKGROUND SPHERES (Dynamic Parallax)
   ========================================================================== */
.sphere {
    position: absolute;
    pointer-events: none;
    z-index: -1;
    transition: transform 0.1s ease-out; /* smooth parallax tracking */
}

.sphere-inner {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    filter: blur(10px); /* Mild blur for depth of field */
    opacity: 0.25;
}

.sphere-1 {
    width: 350px;
    height: 350px;
    top: 5%;
    left: -5%;
}
.sphere-1 .sphere-inner {
    background: radial-gradient(circle at 30% 30%, #ff80ab 0%, rgba(255, 128, 171, 0) 70%);
    box-shadow: inset -20px -20px 50px rgba(255, 255, 255, 0.4), 0 0 80px rgba(255, 128, 171, 0.15);
    animation: sphereFloat1 22s ease-in-out infinite;
}

.sphere-2 {
    width: 450px;
    height: 450px;
    top: 30%;
    right: -10%;
}
.sphere-2 .sphere-inner {
    background: radial-gradient(circle at 30% 30%, #80deea 0%, rgba(128, 222, 234, 0) 70%);
    box-shadow: inset -20px -20px 50px rgba(255, 255, 255, 0.4), 0 0 80px rgba(128, 222, 234, 0.15);
    animation: sphereFloat2 28s ease-in-out infinite;
}

.sphere-3 {
    width: 300px;
    height: 300px;
    bottom: 25%;
    left: 10%;
}
.sphere-3 .sphere-inner {
    background: radial-gradient(circle at 30% 30%, #b39ddb 0%, rgba(179, 157, 219, 0) 70%);
    box-shadow: inset -20px -20px 50px rgba(255, 255, 255, 0.4), 0 0 80px rgba(179, 157, 219, 0.15);
    animation: sphereFloat3 24s ease-in-out infinite;
}

.sphere-4 {
    width: 500px;
    height: 500px;
    bottom: 5%;
    right: -5%;
}
.sphere-4 .sphere-inner {
    background: radial-gradient(circle at 30% 30%, #ffe082 0%, rgba(255, 224, 130, 0) 70%);
    box-shadow: inset -20px -20px 50px rgba(255, 255, 255, 0.4), 0 0 80px rgba(255, 224, 130, 0.12);
    animation: sphereFloat4 26s ease-in-out infinite;
}

/* Keyframes for Floating spheres */
@keyframes sphereFloat1 {
    0% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(30px, -40px) scale(1.05); }
    66% { transform: translate(-20px, 20px) scale(0.96); }
    100% { transform: translate(0, 0) scale(1); }
}
@keyframes sphereFloat2 {
    0% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(-45px, 35px) scale(0.94); }
    100% { transform: translate(0, 0) scale(1); }
}
@keyframes sphereFloat3 {
    0% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(-25px, -30px) scale(1.04); }
    66% { transform: translate(30px, 15px) scale(0.96); }
    100% { transform: translate(0, 0) scale(1); }
}
@keyframes sphereFloat4 {
    0% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(35px, -45px) scale(1.05); }
    100% { transform: translate(0, 0) scale(1); }
}

/* ==========================================================================
   MAIN 3D VIEWPORT CONTAINER
   ========================================================================== */
.container-3d {
    width: 100%;
    max-width: 1300px;
    margin: 0 auto;
    padding: 80px 24px 60px;
    position: relative;
    z-index: 1;
}

/* ==========================================================================
   3D HEADER
   ========================================================================== */
.header-3d {
    text-align: center;
    margin-bottom: 100px;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    transform-style: preserve-3d;
}

.header-cover-wrapper {
    width: 100%;
    max-width: 700px;
    aspect-ratio: 16 / 9;
    height: auto;
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: 40px;
    border: 1px solid rgba(255, 255, 255, 0.45);
    box-shadow: 
        0 15px 35px rgba(28, 25, 23, 0.08),
        inset 0 1px 1px rgba(255, 255, 255, 0.5);
    transform: translateZ(25px); /* Floating 3D cover banner card */
    transition: transform 0.3s ease;
    
    /* Vignette mask to blend smoothly into the cream background */
    mask-image: radial-gradient(ellipse 90% 90% at 50% 50%, black 50%, transparent 100%);
    -webkit-mask-image: radial-gradient(ellipse 90% 90% at 50% 50%, black 50%, transparent 100%);
}

.header-cover-wrapper:hover {
    transform: translateZ(40px) scale(1.01);
}

.header-cover-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    filter: brightness(0.95) contrast(0.98);
}

.title-3d {
    font-size: clamp(2.4rem, 5.2vw, 4.5rem);
    font-weight: 800;
    letter-spacing: -1.5px;
    line-height: 1.15;
    color: #c20037;
    position: relative;
    text-shadow: 
        0 1px 0 #9c002c,
        0 2px 0 #850025,
        0 3px 0 #6e001f,
        0 4px 0 #570018,
        0 6px 20px rgba(194, 0, 55, 0.3);
    margin-bottom: 24px;
    transform: translateZ(50px);
    max-width: 1000px;
}

.intro-description-3d {
    max-width: 920px;
    margin: 0 auto 48px;
    text-align: justify;
    font-size: 1.05rem;
    line-height: 1.8;
    color: var(--color-text-main);
    background: rgba(255, 255, 255, 0.42);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.55);
    border-radius: var(--radius-lg);
    padding: 36px 42px;
    box-shadow: 
        0 12px 35px rgba(28, 25, 23, 0.05),
        inset 0 1px 1px rgba(255, 255, 255, 0.7);
    transform: translateZ(35px);
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.intro-description-3d p {
    text-indent: 1.5rem;
}

.intro-description-3d p.intro-callout {
    text-indent: 0;
    margin-top: 10px;
    padding: 18px 24px;
    background: rgba(194, 0, 55, 0.06);
    border-left: 4px solid var(--color-red);
    border-radius: var(--radius-sm);
    font-size: 1.08rem;
    font-weight: 700;
    color: #9c002c;
    font-style: italic;
    text-align: left;
}

/* Scroll indicator */
.mouse-scroll-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
    transform: translateZ(20px);
    opacity: 0.7;
}

.mouse-icon {
    width: 24px;
    height: 40px;
    border: 2px solid var(--color-text-muted);
    border-radius: var(--radius-pill);
    position: relative;
}

.mouse-wheel {
    width: 4px;
    height: 8px;
    background-color: var(--color-text-main);
    border-radius: 50%;
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    animation: scrollWheel 1.5s infinite;
}

@keyframes scrollWheel {
    0% { top: 8px; opacity: 1; }
    50% { top: 16px; opacity: 0; }
    100% { top: 8px; opacity: 1; }
}

.indicator-text {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    letter-spacing: 1px;
    text-transform: uppercase;
}

/* ==========================================================================
   3D CARDS GRID (2x2 Layout)
   ========================================================================== */
.cards-3d-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 60px;
    width: 100%;
}

/* 3D Card Parent Wrapper */
.card-3d {
    perspective: 1000px; /* Perspective applied to each card cell */
}

/* Inner transform box (This is what actually tilts) */
.card-3d-inner {
    position: relative;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.38); /* Frosted glassmorphism background */
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid rgba(255, 255, 255, 0.45);
    border-radius: var(--radius-lg);
    padding: 35px;
    transform-style: preserve-3d; /* CRITICAL: Enables translateZ on children! */
    box-shadow: 
        0 15px 35px rgba(28, 25, 23, 0.06),
        inset 0 1px 1px rgba(255, 255, 255, 0.5),
        inset 0 -1px 1px rgba(28, 25, 23, 0.04);
    transition: transform 0.15s ease-out, box-shadow 0.3s ease, border-color 0.3s ease;
    cursor: pointer;
}

/* Shine overlay reflecting light in 3D */
.card-3d-shine {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: var(--radius-lg);
    background: radial-gradient(
        circle 300px at var(--shine-x, 0px) var(--shine-y, 0px),
        rgba(255, 255, 255, 0.18),
        transparent 80%
    );
    z-index: 5;
    pointer-events: none;
}

/* Card content details with translateZ layers */
.card-3d-image-wrapper {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* 16:9 Aspect Ratio */
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: 28px;
    transform: translateZ(35px); /* Pops the image above the card */
    box-shadow: 0 8px 24px rgba(28, 25, 23, 0.12);
    transition: transform 0.3s ease;
}

.card-3d-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    filter: brightness(0.85) contrast(1.05);
}

.card-3d-content {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    transform-style: preserve-3d;
}

.card-3d-title {
    font-size: 1.6rem;
    font-weight: 800;
    margin-bottom: 16px;
    letter-spacing: -0.5px;
    transform: translateZ(55px); /* Title pops out even more */
    transition: color 0.3s ease;
}

/* Glowing Neon Colors per card */
.title-green { color: var(--color-green); text-shadow: 0 1px 2px rgba(0, 138, 61, 0.1); }
.title-cyan { color: var(--color-cyan); text-shadow: 0 1px 2px rgba(0, 128, 150, 0.1); }
.title-red { color: var(--color-red); text-shadow: 0 1px 2px rgba(194, 0, 55, 0.1); }
.title-yellow { color: var(--color-yellow); text-shadow: 0 1px 2px rgba(202, 138, 4, 0.1); }
.title-purple { color: var(--color-purple); text-shadow: 0 1px 2px rgba(124, 58, 237, 0.1); }

.card-3d-desc {
    font-size: 0.95rem;
    color: var(--color-text-muted);
    line-height: 1.6;
    margin-bottom: 24px;
    transform: translateZ(40px);
}

.card-3d-meta {
    display: flex;
    gap: 16px;
    font-size: 0.8rem;
    color: var(--color-text-muted);
    margin-bottom: 28px;
    transform: translateZ(35px);
}

.card-3d-meta span {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* 3D Interactive Button */
.btn-3d {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--color-text-main);
    transform: translateZ(50px);
    transition: var(--transition-bounce);
    transform-style: preserve-3d;
}

.btn-3d i {
    transition: transform 0.3s ease;
}

.btn-3d:hover i {
    transform: translateX(6px);
}

/* Button colors */
.btn-green:hover {
    background-color: var(--color-green);
    border-color: var(--color-green);
    color: #fff;
    box-shadow: 0 5px 15px rgba(0, 138, 61, 0.2);
}

.btn-cyan:hover {
    background-color: var(--color-cyan);
    border-color: var(--color-cyan);
    color: #fff;
    box-shadow: 0 5px 15px rgba(0, 128, 150, 0.2);
}

.btn-red:hover {
    background-color: var(--color-red);
    border-color: var(--color-red);
    color: #fff;
    box-shadow: 0 5px 15px rgba(194, 0, 55, 0.2);
}

.btn-yellow:hover {
    background-color: var(--color-yellow);
    border-color: var(--color-yellow);
    color: #fff;
    box-shadow: 0 5px 15px rgba(202, 138, 4, 0.2);
}

.btn-purple:hover {
    background-color: var(--color-purple);
    border-color: var(--color-purple);
    color: #fff;
    box-shadow: 0 5px 15px rgba(124, 58, 237, 0.2);
}

/* ==========================================================================
   HOVER ACTIONS & 3D INTERACTION STYLES
   ========================================================================== */
.card-3d-inner:hover {
    border-color: rgba(28, 25, 23, 0.15);
    box-shadow: 0 25px 60px rgba(28, 25, 23, 0.12);
}

/* Color glow cards on hover */
#card-songhong:hover .card-3d-inner { border-color: rgba(0, 138, 61, 0.3); box-shadow: 0 25px 60px rgba(0, 138, 61, 0.08); }
#card-hatang:hover .card-3d-inner { border-color: rgba(0, 128, 150, 0.3); box-shadow: 0 25px 60px rgba(0, 128, 150, 0.08); }
#card-kinhteso:hover .card-3d-inner { border-color: rgba(194, 0, 55, 0.3); box-shadow: 0 25px 60px rgba(194, 0, 55, 0.08); }
#card-disan:hover .card-3d-inner { border-color: rgba(202, 138, 4, 0.3); box-shadow: 0 25px 60px rgba(202, 138, 4, 0.08); }
#card-dothixanh:hover .card-3d-inner { border-color: rgba(124, 58, 237, 0.3); box-shadow: 0 25px 60px rgba(124, 58, 237, 0.08); }

/* Centered layout for 5th card on wide screens */
@media (min-width: 993px) {
    #card-kinhteso {
        grid-column: 1 / -1;
        max-width: 620px;
        justify-self: center;
        width: 100%;
    }
}

/* Zoom image wrapper slightly on card hover */
.card-3d-inner:hover .card-3d-image-wrapper {
    transform: translateZ(55px); /* elevate image wrapper more */
}

/* ==========================================================================
   3D ENTRANCE REVEAL ON SCROLL
   ========================================================================== */
.reveal-3d {
    opacity: 0;
    transform: perspective(1000px) rotateY(25deg) rotateX(15deg) translateZ(-120px) translateY(50px);
    transition: opacity 1.2s cubic-bezier(0.16, 1, 0.3, 1), 
                transform 1.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal-3d.revealed {
    opacity: 1;
    transform: perspective(1000px) rotateY(0) rotateX(0) translateZ(0) translateY(0);
}

/* 3D Bobbing Float animations for cards (starts after entrance transition) */
#card-songhong.revealed { animation: cardFloat1 6.5s ease-in-out 1.2s infinite alternate; }
#card-hatang.revealed { animation: cardFloat2 7.5s ease-in-out 1.2s infinite alternate; }
#card-kinhteso.revealed { animation: cardFloat3 8.5s ease-in-out 1.2s infinite alternate; }
#card-disan.revealed { animation: cardFloat4 7.0s ease-in-out 1.2s infinite alternate; }
#card-dothixanh.revealed { animation: cardFloat5 8.0s ease-in-out 1.2s infinite alternate; }

@keyframes cardFloat1 {
    0% { transform: translateY(0); }
    100% { transform: translateY(-12px); }
}
@keyframes cardFloat2 {
    0% { transform: translateY(0); }
    100% { transform: translateY(-10px); }
}
@keyframes cardFloat3 {
    0% { transform: translateY(0); }
    100% { transform: translateY(-15px); }
}
@keyframes cardFloat4 {
    0% { transform: translateY(0); }
    100% { transform: translateY(-8px); }
}
@keyframes cardFloat5 {
    0% { transform: translateY(0); }
    100% { transform: translateY(-11px); }
}

/* ==========================================================================
   FOOTER SECTION
   ========================================================================== */
.footer-3d {
    margin-top: 100px;
    border-top: 1px solid var(--color-border);
    padding-top: 40px;
    text-align: center;
}

.footer-3d p {
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

/* ==========================================================================
   RESPONSIVE DESIGN BREAKPOINTS
   ========================================================================== */
@media (max-width: 992px) {
    .cards-3d-grid {
        grid-template-columns: 1fr;
        gap: 48px;
    }
}

@media (max-width: 768px) {
    .container-3d {
        padding: 50px 16px 40px;
    }
    
    .header-3d {
        margin-bottom: 50px;
    }
    
    .card-3d-inner {
        padding: 24px;
    }
    
    /* Disable background blur spheres for mobile scroll performance */
    .sphere {
        display: none !important;
    }
    
    /* Turn off 3D layers translation on small screens */
    .card-3d-image-wrapper,
    .card-3d-title,
    .card-3d-desc,
    .card-3d-meta,
    .btn-3d,
    .intro-description-3d {
        transform: none !important;
    }

    .intro-description-3d {
        padding: 24px 20px;
        font-size: 0.95rem;
        text-align: left;
    }
    
    .intro-description-3d p {
        text-indent: 0;
    }
}

@media (max-width: 480px) {
    .title-3d {
        font-size: clamp(2rem, 9vw, 2.75rem);
        letter-spacing: -1px;
        text-shadow: 
            0 1px 0 #15143a,
            0 2px 0 #121136,
            0 3px 12px rgba(0,0,0,0.5);
        margin-bottom: 16px;
    }
    
    .subtitle-3d {
        font-size: 0.95rem;
        margin-bottom: 24px;
    }
    
    .mouse-scroll-indicator {
        display: none !important; /* Hide mouse scroll icon on mobile */
    }
    
    .card-3d-inner {
        padding: 20px;
        border-radius: var(--radius-md);
    }
    
    .card-3d-image-wrapper {
        margin-bottom: 20px;
        border-radius: var(--radius-sm);
    }
    
    .card-3d-title {
        font-size: 1.3rem;
        margin-bottom: 12px;
    }
    
    .card-3d-desc {
        font-size: 0.88rem;
        margin-bottom: 16px;
    }
    
    .card-3d-meta {
        margin-bottom: 20px;
        font-size: 0.75rem;
    }
    
    .btn-3d {
        width: 100%;
        justify-content: center;
        padding: 10px 20px;
    }
}


