/* ===================================
   PIERFRANCESCO AMENDOLA - 3D PORTFOLIO
   Inspired by ladunjexa/reactjs18-3d-portfolio
   =================================== */

:root {
    --primary: #050816;
    --secondary: #aaa6c3;
    --tertiary: #151030;
    --black-100: #100d25;
    --black-200: #090325;
    --white-100: #f3f3f3;
    --accent: #915EFF;
    --accent-light: #a87bff;
    --card-shadow: 0px 35px 120px -15px #211e35;
    --font: 'Poppins', sans-serif;
}

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 80px;
}

body {
    font-family: var(--font);
    background: var(--primary);
    color: var(--white-100);
    line-height: 1.7;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

a {
    text-decoration: none;
    color: inherit;
    transition: color 0.3s;
}

ul { list-style: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

#stars-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 100;
    padding: 20px 0;
    transition: all 0.4s ease;
}

.navbar.scrolled {
    background: rgba(5, 8, 22, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    padding: 12px 0;
    border-bottom: 1px solid rgba(145, 94, 255, 0.1);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 1.3rem;
    font-weight: 700;
    z-index: 101;
}

.logo-text {
    background: linear-gradient(135deg, var(--accent), #c084fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    animation: logoPulse 2s ease-in-out infinite;
}

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

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

.nav-links a {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--secondary);
    transition: color 0.3s;
    position: relative;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--accent);
    transition: width 0.3s ease;
}

.nav-links a:hover { color: var(--white-100); }
.nav-links a:hover::after { width: 100%; }
.nav-links a.active { color: var(--white-100); }
.nav-links a.active::after { width: 100%; }

.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    z-index: 101;
    padding: 4px;
}

.nav-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--white-100);
    border-radius: 2px;
    transition: all 0.3s ease;
}

.nav-toggle.active span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.nav-toggle.active span:nth-child(2) { opacity: 0; }
.nav-toggle.active span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

.mobile-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(5, 8, 22, 0.95);
    backdrop-filter: blur(20px);
    z-index: 99;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.mobile-menu.active {
    opacity: 1;
    pointer-events: all;
}

.mobile-menu-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 28px;
}

.mobile-menu-content a {
    font-size: 1.8rem;
    font-weight: 600;
    color: var(--secondary);
    transition: all 0.3s;
}

.mobile-menu-content a:hover { color: var(--accent); }

.hero {
    position: relative;
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 120px 24px 60px;
    z-index: 1;
    max-width: 1200px;
    margin: 0 auto;
}

.hero-content {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 40px;
}

.hero-left {
    flex: 1;
    min-width: 0;
}

.hero-right {
    flex: 0 0 420px;
    height: 420px;
    position: relative;
}

#solar-system {
    width: 100%;
    height: 100%;
    display: block;
}

.hero-text-block { max-width: 720px; }

.hero-greeting {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

.hero-line {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--accent);
    flex-shrink: 0;
}

.hero-greeting span {
    font-size: 1.5rem;
    font-weight: 500;
    color: var(--secondary);
}

.hero-status-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border-radius: 999px;
    padding: 8px 14px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #c9ffe0;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.16), rgba(16, 185, 129, 0.05));
    border: 1px solid rgba(16, 185, 129, 0.35);
    margin-bottom: 16px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #34d399;
    box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.6);
    animation: statusPulse 1.8s ease-out infinite;
}

@keyframes statusPulse {
    0% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.55); }
    70% { box-shadow: 0 0 0 10px rgba(52, 211, 153, 0); }
    100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); }
}

.hero-name {
    font-size: clamp(2.8rem, 7vw, 4.5rem);
    font-weight: 900;
    line-height: 1.1;
    margin-bottom: 16px;
    color: var(--white-100);
}

.hero-tagline {
    font-size: 1.15rem;
    color: var(--secondary);
    max-width: 560px;
    line-height: 1.8;
    margin-bottom: 32px;
}

.gradient-text {
    background: linear-gradient(90deg, #915EFF, #c084fc, #e879f9);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
}

.hero-cta {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 32px;
    background: linear-gradient(135deg, var(--accent), #c084fc);
    color: #fff;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    box-shadow: 0 8px 32px rgba(145, 94, 255, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(145, 94, 255, 0.5);
}

.btn-primary svg { width: 18px; height: 18px; }

.btn-outline {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 32px;
    border: 2px solid rgba(145, 94, 255, 0.4);
    color: var(--accent-light);
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.btn-outline:hover {
    background: rgba(145, 94, 255, 0.1);
    border-color: var(--accent);
    transform: translateY(-2px);
}

.btn-outline svg { width: 18px; height: 18px; }

.btn-download {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 28px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--white-100);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.3), rgba(59, 130, 246, 0.25));
    border: 1px solid rgba(129, 140, 248, 0.45);
    transition: all 0.3s ease;
}

.btn-download:hover {
    transform: translateY(-2px);
    border-color: rgba(129, 140, 248, 0.8);
    box-shadow: 0 10px 30px rgba(99, 102, 241, 0.25);
}

.btn-download svg { width: 18px; height: 18px; }

.hero-scroll {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
}

.scroll-mouse {
    width: 28px;
    height: 48px;
    border: 3px solid var(--secondary);
    border-radius: 14px;
    display: flex;
    justify-content: center;
    padding-top: 8px;
}

.scroll-dot {
    width: 6px;
    height: 10px;
    background: var(--secondary);
    border-radius: 3px;
    animation: scrollBounce 2s ease-in-out infinite;
}

@keyframes scrollBounce {
    0% { transform: translateY(0); opacity: 1; }
    50% { transform: translateY(16px); opacity: 0.3; }
    100% { transform: translateY(0); opacity: 1; }
}

.section {
    position: relative;
    z-index: 1;
    padding: 100px 0;
}

.section-header { margin-bottom: 40px; }

#experience .section-header,
#experience .section-description {
    text-align: center;
}

.section-sub {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.section-title {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 900;
    margin-top: 4px;
    background: linear-gradient(90deg, #fff, var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.section-description {
    max-width: 680px;
    color: var(--secondary);
    font-size: 1rem;
    line-height: 1.8;
    margin-bottom: 48px;
}

.section-description strong { color: var(--white-100); }

/* About layout — text left, astronaut right */
.about-layout {
    display: flex;
    align-items: center;
    gap: 48px;
    margin-bottom: 16px;
}

.about-left {
    flex: 1;
    min-width: 0;
}

.about-left .section-description {
    margin-bottom: 0;
}

.about-right {
    flex: 0 0 380px;
    height: 380px;
    position: relative;
}

#astronaut-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* Projects intro layout — text left, coder right */
.projects-intro-layout {
    display: flex;
    align-items: center;
    gap: 48px;
    margin-bottom: 16px;
}

.projects-intro-left {
    flex: 1;
    min-width: 0;
}

.projects-intro-left .section-description {
    margin-bottom: 0;
}

.projects-intro-right {
    flex: 0 0 360px;
    height: 340px;
    position: relative;
}

#coder-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-top: 20px;
}

.service-card {
    background: var(--tertiary);
    border-radius: 20px;
    padding: 40px 24px;
    text-align: center;
    box-shadow: var(--card-shadow);
    transition: all 0.4s ease;
    position: relative;
    overflow: hidden;
}

.services-grid .service-card {
    transform-origin: center;
}

.service-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 20px;
    padding: 2px;
    background: linear-gradient(135deg, transparent, rgba(145, 94, 255, 0.3), transparent);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity 0.4s;
}

.service-card:hover::before { opacity: 1; }
.service-card:hover {
    transform: translateY(-10px) rotate(0.35deg) scale(1.015);
    animation: overviewCardFloat 1.1s ease-in-out infinite alternate;
}

@keyframes overviewCardFloat {
    from { transform: translateY(-8px) rotate(-0.35deg) scale(1.012); }
    to { transform: translateY(-12px) rotate(0.35deg) scale(1.018); }
}

/* Alieno che si affaccia da un solo angolo random per card */
.service-card .alien-peek {
    position: absolute;
    width: 42px;
    height: 42px;
    z-index: 3;
    pointer-events: none;
    transition: transform 0.35s ease;
}

.service-card .alien-head {
    width: 100%;
    height: 100%;
    border-radius: 50% 50% 45% 45%;
    background: radial-gradient(circle at 35% 30%, #a7ff7a, #49c15c 68%, #2e8f3a 100%);
    border: 1px solid rgba(25, 79, 36, 0.7);
    box-shadow: 0 8px 20px rgba(73, 193, 92, 0.35);
    position: relative;
}

.service-card .alien-eyes {
    position: absolute;
    left: 50%;
    top: 47%;
    transform: translate(-50%, -50%);
    display: flex;
    gap: 6px;
}

.service-card .alien-eye {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #f5fff4;
    position: relative;
}

.service-card .alien-eye::after {
    content: '';
    position: absolute;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: #111;
    top: 2px;
    left: 3px;
}

.service-card .alien-peek.eyes-3 .alien-eyes {
    gap: 4px;
}

.service-card .alien-peek.eyes-3 .alien-eye {
    width: 7px;
    height: 7px;
}

.service-card .alien-peek.corner-tl {
    top: -20px;
    left: -18px;
    transform: rotate(-16deg) translateY(-4px);
}

.service-card .alien-peek.corner-tr {
    top: -20px;
    right: -18px;
    transform: rotate(16deg) translateY(-4px);
}

.service-card:hover .alien-peek.corner-tl {
    transform: rotate(-6deg) translate(7px, 8px);
}

.service-card:hover .alien-peek.corner-tr {
    transform: rotate(6deg) translate(-7px, 8px);
}

.service-card .alien-antenna,
.service-card .alien-antenna::after {
    position: absolute;
    content: '';
    width: 2px;
    height: 10px;
    background: #2e8f3a;
    top: -8px;
    left: 11px;
    border-radius: 2px;
    transform: rotate(-20deg);
}

.service-card .alien-antenna::after {
    top: -1px;
    left: 13px;
    transform: rotate(40deg);
}

.service-card .alien-antenna-dot,
.service-card .alien-antenna-dot::after {
    position: absolute;
    content: '';
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #87ff85;
    box-shadow: 0 0 8px rgba(135, 255, 133, 0.7);
    top: -11px;
    left: 9px;
}

.service-card .alien-antenna-dot::after {
    top: 1px;
    left: 14px;
}

.service-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(145, 94, 255, 0.2), rgba(145, 94, 255, 0.05));
    border: 1px solid rgba(145, 94, 255, 0.3);
}

.service-icon svg {
    width: 28px;
    height: 28px;
    color: var(--accent);
}

.service-card h3 {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--white-100);
}

.service-card p {
    font-size: 0.85rem;
    color: var(--secondary);
    line-height: 1.6;
}

.vertical-timeline {
    position: relative;
    max-width: 1000px;
    margin: 0 auto;
    padding: 0;
}

.vertical-timeline::before {
    content: '';
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(to bottom, var(--accent), rgba(145, 94, 255, 0.3), rgba(145, 94, 255, 0.05));
    border-radius: 2px;
}

.timeline-element {
    position: relative;
    width: 50%;
    margin-bottom: 56px;
}

.timeline-element:last-child { margin-bottom: 0; }

/* Left cards */
.tl-left {
    padding-right: 52px;
    left: 0;
    text-align: right;
}

/* Right cards */
.tl-right {
    padding-left: 52px;
    left: 50%;
}

/* Icon centered on the line */
.timeline-icon {
    position: absolute;
    top: 16px;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 4px solid var(--primary);
    z-index: 2;
    box-shadow: 0 0 20px rgba(145, 94, 255, 0.25), 0 0 40px rgba(145, 94, 255, 0.1);
    transition: all 0.4s ease;
}

.timeline-element:hover .timeline-icon {
    box-shadow: 0 0 25px rgba(145, 94, 255, 0.4), 0 0 50px rgba(145, 94, 255, 0.15);
    transform: scale(1.1);
}

.tl-left .timeline-icon {
    right: -26px;
}

.tl-right .timeline-icon {
    left: -26px;
}

.timeline-icon svg {
    width: 22px;
    height: 22px;
    color: #fff;
}

/* Arrow connector */
.timeline-arrow {
    position: absolute;
    top: 24px;
    width: 16px;
    height: 16px;
    background: var(--black-100);
    border: 1px solid rgba(145, 94, 255, 0.15);
    transform: rotate(45deg);
    z-index: 1;
}

.tl-left .timeline-arrow {
    right: -8px;
    border-left: none;
    border-bottom: none;
}

.tl-right .timeline-arrow {
    left: -8px;
    border-right: none;
    border-top: none;
}

/* Badge */
.timeline-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 4px 12px;
    border-radius: 6px;
    margin-bottom: 12px;
}

.badge-education {
    background: rgba(99, 102, 241, 0.15);
    color: #818cf8;
}

.badge-cert {
    background: rgba(145, 94, 255, 0.15);
    color: var(--accent-light);
}

.badge-internship {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
}

/* Card */
.timeline-content-box {
    position: relative;
    background: var(--black-100);
    border-radius: 16px;
    padding: 28px;
    box-shadow: var(--card-shadow);
    border: 1px solid rgba(145, 94, 255, 0.08);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.timeline-content-box:hover {
    border-color: rgba(145, 94, 255, 0.3);
    transform: translateY(-6px);
    box-shadow: 0px 35px 120px -15px #211e35, 0 0 30px rgba(145, 94, 255, 0.08);
}

.timeline-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 4px;
}

.tl-left .timeline-card-header {
    flex-direction: row-reverse;
}

.timeline-content-box h3 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--white-100);
    line-height: 1.3;
}

.timeline-subtitle {
    font-size: 0.88rem;
    color: var(--secondary);
    font-weight: 500;
    margin-bottom: 14px;
}

.timeline-content-box ul { margin-bottom: 12px; }

.timeline-content-box li {
    font-size: 0.86rem;
    color: var(--secondary);
    padding-left: 16px;
    position: relative;
    margin-bottom: 6px;
    line-height: 1.6;
}

.tl-left .timeline-content-box li {
    text-align: left;
}

.timeline-content-box li::before {
    content: '\25b8';
    position: absolute;
    left: 0;
    color: var(--accent);
}

.timeline-date {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--accent-light);
    background: rgba(145, 94, 255, 0.1);
    padding: 5px 14px;
    border-radius: 8px;
    white-space: nowrap;
    flex-shrink: 0;
}

.timeline-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--accent);
    font-weight: 500;
    margin-bottom: 8px;
    transition: all 0.3s;
}

.timeline-link:hover {
    color: var(--accent-light);
    gap: 10px;
}
.timeline-link svg { width: 14px; height: 14px; }

.tech-balls-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 32px;
    margin-top: 20px;
}

.tech-ball {
    width: 110px;
    height: 110px;
    perspective: 400px;
}

.ball-inner {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, rgba(145, 94, 255, 0.4), var(--tertiary));
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow:
        inset -4px -4px 12px rgba(0, 0, 0, 0.4),
        inset 4px 4px 12px rgba(145, 94, 255, 0.15),
        0 8px 32px rgba(0, 0, 0, 0.3);
    transition: all 0.4s ease;
    cursor: default;
    animation: floatBall 3s ease-in-out infinite;
}

.tech-ball:nth-child(even) .ball-inner { animation-delay: -1.5s; }
.tech-ball:nth-child(3n) .ball-inner { animation-delay: -0.75s; }

@keyframes floatBall {
    0%, 100% { transform: translateY(0) rotateX(0) rotateY(0); }
    50% { transform: translateY(-8px) rotateX(5deg) rotateY(5deg); }
}

.ball-inner:hover {
    transform: scale(1.15) translateY(-4px);
    box-shadow:
        inset -4px -4px 12px rgba(0, 0, 0, 0.4),
        inset 4px 4px 12px rgba(145, 94, 255, 0.3),
        0 12px 48px rgba(145, 94, 255, 0.3);
}

.ball-inner {
    flex-direction: column;
    gap: 4px;
}

.ball-inner img {
    width: 44px;
    height: 44px;
    object-fit: contain;
    filter: drop-shadow(0 2px 8px rgba(145, 94, 255, 0.3));
    transition: transform 0.3s ease;
}

.ball-inner:hover img {
    transform: scale(1.1);
}

.ball-inner img.icon-white {
    filter: brightness(0) invert(1) drop-shadow(0 2px 8px rgba(145, 94, 255, 0.3));
}

.ball-inner span {
    font-size: 0.6rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--secondary);
    text-align: center;
    line-height: 1.1;
    margin-top: 2px;
}

.project-tabs {
    display: flex;
    gap: 12px;
    margin-bottom: 36px;
    flex-wrap: wrap;
}

.project-tab {
    padding: 10px 24px;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--secondary);
    background: var(--tertiary);
    border: 1px solid transparent;
    transition: all 0.3s ease;
}

.project-tab:hover { color: var(--white-100); }

.project-tab.active {
    background: linear-gradient(135deg, var(--accent), #c084fc);
    color: #fff;
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 28px;
}

.projects-grid.hidden { display: none; }

.project-card-3d { perspective: 800px; }

.project-card-inner {
    background: var(--tertiary);
    border-radius: 20px;
    padding: 28px;
    box-shadow: var(--card-shadow);
    transition: all 0.5s ease;
    position: relative;
    overflow: hidden;
}

.project-card-inner::before {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0;
    border-radius: 20px;
    background: linear-gradient(135deg, rgba(145, 94, 255, 0.08), transparent);
    transition: opacity 0.4s;
}

.project-card-inner:hover::before { opacity: 1; }
.project-card-inner:hover { transform: translateY(-8px); }

.project-card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
}

.project-icon-circle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.project-icon-circle svg {
    width: 28px;
    height: 28px;
    color: #fff;
}

.project-card-links a {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.project-card-links a:hover {
    background: rgba(145, 94, 255, 0.3);
    transform: scale(1.1);
}

.project-card-links svg {
    width: 20px;
    height: 20px;
    color: var(--white-100);
}

.project-card-inner h3 {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--white-100);
}

.project-card-inner p {
    font-size: 0.88rem;
    color: var(--secondary);
    line-height: 1.7;
    margin-bottom: 16px;
}

.project-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag-blue { font-size: 0.78rem; font-weight: 600; color: #60a5fa; }
.tag-green { font-size: 0.78rem; font-weight: 600; color: #34d399; }
.tag-pink { font-size: 0.78rem; font-weight: 600; color: #f472b6; }
.tag-blue::before, .tag-green::before, .tag-pink::before { content: '#'; }

.project-grade, .coming-badge {
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 700;
}

.project-grade { background: rgba(52, 211, 153, 0.15); color: #34d399; }
.coming-badge { background: rgba(145, 94, 255, 0.15); color: var(--accent-light); }
.coming-soon-card { opacity: 0.7; }

.achievements-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
}

.achievement-card {
    background: var(--black-100);
    border-radius: 16px;
    padding: 28px;
    box-shadow: var(--card-shadow);
    transition: all 0.4s ease;
    border: 1px solid rgba(145, 94, 255, 0.05);
}

.achievement-card:hover {
    transform: translateY(-6px);
    border-color: rgba(145, 94, 255, 0.2);
}

.achievement-emoji { font-size: 2.5rem; display: block; margin-bottom: 14px; }

.achievement-card h4 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--white-100);
    margin-bottom: 8px;
}

.achievement-card p {
    font-size: 0.88rem;
    color: var(--secondary);
    line-height: 1.7;
}

.community-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
}

.community-card {
    background: var(--black-100);
    border-radius: 16px;
    padding: 28px;
    box-shadow: var(--card-shadow);
    transition: all 0.35s ease;
    border: 1px solid rgba(145, 94, 255, 0.08);
}

.community-card:hover {
    transform: translateY(-6px);
    border-color: rgba(145, 94, 255, 0.2);
}

.community-icon {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(145, 94, 255, 0.2), rgba(145, 94, 255, 0.05));
    border: 1px solid rgba(145, 94, 255, 0.3);
    margin-bottom: 14px;
}

.community-icon svg {
    width: 22px;
    height: 22px;
    color: var(--accent);
}

.community-card h4 {
    font-size: 1.08rem;
    color: var(--white-100);
    margin-bottom: 8px;
}

.community-card p {
    color: var(--secondary);
    font-size: 0.9rem;
    line-height: 1.7;
}

.languages-layout {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px;
}

.language-panel {
    background: linear-gradient(135deg, var(--tertiary), var(--black-100));
    border-radius: 20px;
    padding: 30px;
    border: 1px solid rgba(145, 94, 255, 0.12);
    box-shadow: var(--card-shadow);
}

.language-panel h3 {
    font-size: 1.25rem;
    color: var(--white-100);
    margin-bottom: 16px;
}

.language-panel ul {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 18px;
}

.language-panel li {
    color: var(--secondary);
    font-size: 0.92rem;
    line-height: 1.6;
}

.language-panel strong {
    color: var(--white-100);
}

.language-quote {
    border-left: 3px solid rgba(145, 94, 255, 0.5);
    padding-left: 14px;
    color: var(--accent-light);
    font-size: 0.92rem;
    font-style: italic;
    line-height: 1.6;
    margin-top: 4px;
}

.contact-section { position: relative; }

.contact-layout {
    display: flex;
    align-items: flex-start;
    gap: 48px;
}

.contact-wrapper {
    flex: 1;
    min-width: 0;
}

.contact-earth-wrapper {
    flex: 0 0 380px;
    height: 380px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

#earth-container {
    width: 100%;
    height: 100%;
    display: block;
    border-radius: 20px;
    overflow: hidden;
}

.contact-text p {
    font-size: 1rem;
    color: var(--secondary);
    line-height: 1.8;
    margin-bottom: 32px;
}

.contact-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    margin-bottom: 40px;
}

.contact-info-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: var(--tertiary);
    border-radius: 14px;
    transition: all 0.3s ease;
    border: 1px solid rgba(145, 94, 255, 0.05);
}

.contact-info-item:hover {
    transform: translateY(-4px);
    border-color: rgba(145, 94, 255, 0.2);
    background: var(--black-100);
}

.contact-info-item svg {
    width: 24px;
    height: 24px;
    color: var(--accent);
    flex-shrink: 0;
}

.contact-info-item img.contact-logo {
    width: 22px;
    height: 22px;
    object-fit: contain;
    filter: brightness(0) saturate(100%) invert(52%) sepia(61%) saturate(1308%) hue-rotate(223deg) brightness(99%) contrast(103%);
    flex-shrink: 0;
}

.contact-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.contact-value {
    display: block;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--white-100);
}

.contact-cta-box {
    background: linear-gradient(135deg, var(--tertiary), var(--black-100));
    border-radius: 20px;
    padding: 36px;
    border: 1px solid rgba(145, 94, 255, 0.15);
}

.contact-cta-box h3 {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--white-100);
}

.contact-cta-box > p {
    color: var(--secondary);
    font-size: 0.95rem;
    margin-bottom: 20px;
}

.quick-links-icons {
    margin-top: 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.quick-links-icons a {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(145, 94, 255, 0.12);
    border: 1px solid rgba(145, 94, 255, 0.2);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s ease;
}

.quick-links-icons a:hover {
    transform: translateY(-3px);
    background: rgba(145, 94, 255, 0.22);
    border-color: rgba(145, 94, 255, 0.45);
}

.quick-links-icons svg {
    width: 18px;
    height: 18px;
    color: var(--white-100);
}

.quick-links-icons img.social-logo,
.footer-socials img.social-logo {
    width: 18px;
    height: 18px;
    object-fit: contain;
    filter: brightness(0) invert(1);
}

.footer {
    position: relative;
    z-index: 1;
    padding: 40px 0 24px;
    border-top: 1px solid rgba(145, 94, 255, 0.08);
}

.footer-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 16px;
}

.footer-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.footer-brand .logo-text { font-size: 1.2rem; font-weight: 700; }
.footer-brand p { color: var(--secondary); font-size: 0.85rem; }

.footer-socials { display: flex; gap: 16px; }

.footer-socials a {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.footer-socials a:hover {
    background: var(--accent);
    transform: translateY(-3px);
}

.footer-socials svg { width: 18px; height: 18px; color: var(--secondary); }
.footer-socials a:hover svg { color: #fff; }
.footer-socials img.social-logo { opacity: 0.85; transition: opacity 0.3s ease; }
.footer-socials a:hover img.social-logo { opacity: 1; }

.footer-bottom {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid rgba(145, 94, 255, 0.06);
}

.footer-bottom p { font-size: 0.8rem; color: var(--secondary); }

[data-animate] {
    opacity: 0;
    transform: translateY(40px);
    transition: all 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-animate].visible {
    opacity: 1;
    transform: translateY(0);
}

.services-grid [data-animate]:nth-child(1) { transition-delay: 0s; }
.services-grid [data-animate]:nth-child(2) { transition-delay: 0.1s; }
.services-grid [data-animate]:nth-child(3) { transition-delay: 0.2s; }
.services-grid [data-animate]:nth-child(4) { transition-delay: 0.3s; }

.projects-grid [data-animate]:nth-child(1) { transition-delay: 0s; }
.projects-grid [data-animate]:nth-child(2) { transition-delay: 0.15s; }
.projects-grid [data-animate]:nth-child(3) { transition-delay: 0.3s; }
.projects-grid [data-animate]:nth-child(4) { transition-delay: 0.45s; }
.projects-grid [data-animate]:nth-child(5) { transition-delay: 0.6s; }
.projects-grid [data-animate]:nth-child(6) { transition-delay: 0.75s; }

.vertical-timeline .timeline-element:nth-child(1) { transition-delay: 0s; }
.vertical-timeline .timeline-element:nth-child(2) { transition-delay: 0.15s; }
.vertical-timeline .timeline-element:nth-child(3) { transition-delay: 0.3s; }
.vertical-timeline .timeline-element:nth-child(4) { transition-delay: 0.45s; }
.vertical-timeline .timeline-element:nth-child(5) { transition-delay: 0.6s; }
.vertical-timeline .timeline-element:nth-child(6) { transition-delay: 0.75s; }
.vertical-timeline .timeline-element:nth-child(7) { transition-delay: 0.9s; }
.vertical-timeline .timeline-element:nth-child(8) { transition-delay: 1.05s; }
.vertical-timeline .timeline-element:nth-child(9) { transition-delay: 1.2s; }
.vertical-timeline .timeline-element:nth-child(10) { transition-delay: 1.35s; }
.vertical-timeline .timeline-element:nth-child(11) { transition-delay: 1.5s; }
.vertical-timeline .timeline-element:nth-child(12) { transition-delay: 1.65s; }
.vertical-timeline .timeline-element:nth-child(13) { transition-delay: 1.8s; }
.vertical-timeline .timeline-element:nth-child(14) { transition-delay: 1.95s; }
.vertical-timeline .timeline-element:nth-child(15) { transition-delay: 2.1s; }

.tech-balls-grid [data-animate]:nth-child(1) { transition-delay: 0s; }
.tech-balls-grid [data-animate]:nth-child(2) { transition-delay: 0.05s; }
.tech-balls-grid [data-animate]:nth-child(3) { transition-delay: 0.1s; }
.tech-balls-grid [data-animate]:nth-child(4) { transition-delay: 0.15s; }
.tech-balls-grid [data-animate]:nth-child(5) { transition-delay: 0.2s; }
.tech-balls-grid [data-animate]:nth-child(6) { transition-delay: 0.25s; }
.tech-balls-grid [data-animate]:nth-child(7) { transition-delay: 0.3s; }
.tech-balls-grid [data-animate]:nth-child(8) { transition-delay: 0.35s; }
.tech-balls-grid [data-animate]:nth-child(9) { transition-delay: 0.4s; }
.tech-balls-grid [data-animate]:nth-child(10) { transition-delay: 0.45s; }
.tech-balls-grid [data-animate]:nth-child(11) { transition-delay: 0.5s; }
.tech-balls-grid [data-animate]:nth-child(12) { transition-delay: 0.55s; }
.tech-balls-grid [data-animate]:nth-child(13) { transition-delay: 0.6s; }
.tech-balls-grid [data-animate]:nth-child(14) { transition-delay: 0.65s; }
.tech-balls-grid [data-animate]:nth-child(15) { transition-delay: 0.7s; }
.tech-balls-grid [data-animate]:nth-child(16) { transition-delay: 0.75s; }
.tech-balls-grid [data-animate]:nth-child(17) { transition-delay: 0.8s; }
.tech-balls-grid [data-animate]:nth-child(18) { transition-delay: 0.85s; }
.tech-balls-grid [data-animate]:nth-child(19) { transition-delay: 0.9s; }
.tech-balls-grid [data-animate]:nth-child(20) { transition-delay: 0.95s; }
.tech-balls-grid [data-animate]:nth-child(21) { transition-delay: 1s; }
.tech-balls-grid [data-animate]:nth-child(22) { transition-delay: 1.05s; }
.tech-balls-grid [data-animate]:nth-child(23) { transition-delay: 1.1s; }
.tech-balls-grid [data-animate]:nth-child(24) { transition-delay: 1.15s; }
.tech-balls-grid [data-animate]:nth-child(25) { transition-delay: 1.2s; }
.tech-balls-grid [data-animate]:nth-child(26) { transition-delay: 1.25s; }
.tech-balls-grid [data-animate]:nth-child(27) { transition-delay: 1.3s; }
.tech-balls-grid [data-animate]:nth-child(28) { transition-delay: 1.35s; }
.tech-balls-grid [data-animate]:nth-child(29) { transition-delay: 1.4s; }

.achievements-grid [data-animate]:nth-child(1) { transition-delay: 0s; }
.achievements-grid [data-animate]:nth-child(2) { transition-delay: 0.1s; }
.achievements-grid [data-animate]:nth-child(3) { transition-delay: 0.2s; }
.achievements-grid [data-animate]:nth-child(4) { transition-delay: 0.3s; }
.achievements-grid [data-animate]:nth-child(5) { transition-delay: 0.4s; }
.achievements-grid [data-animate]:nth-child(6) { transition-delay: 0.5s; }

.community-grid [data-animate]:nth-child(1) { transition-delay: 0s; }
.community-grid [data-animate]:nth-child(2) { transition-delay: 0.12s; }
.community-grid [data-animate]:nth-child(3) { transition-delay: 0.24s; }

.languages-layout [data-animate]:nth-child(1) { transition-delay: 0s; }
.languages-layout [data-animate]:nth-child(2) { transition-delay: 0.12s; }

[data-tilt] {
    transform-style: preserve-3d;
    will-change: transform;
}

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--primary); }
::-webkit-scrollbar-thumb { background: rgba(145, 94, 255, 0.3); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(145, 94, 255, 0.5); }

::selection {
    background: rgba(145, 94, 255, 0.3);
    color: var(--white-100);
}

@media (max-width: 1024px) {
    .nav-links { display: none; }
    .nav-toggle { display: flex; }
    .hero { padding: 100px 24px 60px; }
    .hero-content { flex-direction: column; }
    .hero-right { flex: 0 0 360px; height: 360px; width: 100%; max-width: 400px; margin: 0 auto; }
    .section { padding: 80px 0; }
    .about-layout { flex-direction: column; }
    .about-right { flex: none; width: 100%; max-width: 360px; height: 360px; margin: 0 auto; }
    .projects-intro-layout { flex-direction: column; }
    .projects-intro-right { flex: none; width: 100%; max-width: 340px; height: 320px; margin: 0 auto; }
}

@media (max-width: 768px) {
    .services-grid { grid-template-columns: 1fr 1fr; }
    .projects-grid { grid-template-columns: 1fr; }
    .achievements-grid { grid-template-columns: 1fr; }
    .community-grid { grid-template-columns: 1fr; }
    .contact-info-grid { grid-template-columns: 1fr; }
    .languages-layout { grid-template-columns: 1fr; }
    .hero-name { font-size: 2.5rem; }
    .hero-tagline { font-size: 1rem; }
    .section-title { font-size: 2rem; }
    .vertical-timeline { padding-left: 50px; }
    .vertical-timeline::before { left: 18px; transform: none; }
    .timeline-element { width: 100%; left: 0 !important; }
    .tl-left, .tl-right { padding-left: 52px; padding-right: 0; text-align: left; }
    .tl-left .timeline-icon, .tl-right .timeline-icon { left: -26px; right: auto; width: 40px; height: 40px; }
    .timeline-icon svg { width: 16px; height: 16px; }
    .tl-left .timeline-arrow, .tl-right .timeline-arrow { left: -8px; right: auto; border: 1px solid rgba(145, 94, 255, 0.15); border-right: none; border-top: none; }
    .tl-left .timeline-card-header { flex-direction: row; }
    .tl-left .timeline-content-box li { text-align: left; }
    .tech-ball { width: 90px; height: 90px; }
    .tech-balls-grid { gap: 20px; }
    .ball-inner img { width: 36px; height: 36px; }
    .ball-inner span { font-size: 0.55rem; }
    .contact-layout { flex-direction: column; }
    .contact-earth-wrapper { flex: none; width: 100%; max-width: 340px; height: 340px; margin: 0 auto; }
}

@media (max-width: 480px) {
    .hero { padding: 80px 16px 40px; }
    .hero-right { flex: 0 0 280px; height: 280px; }
    .about-right { max-width: 280px; height: 280px; }
    .projects-intro-right { max-width: 260px; height: 260px; }
    .container { padding: 0 16px; }
    .hero-name { font-size: 2rem; }
    .services-grid { grid-template-columns: 1fr; }
    .hero-cta { flex-direction: column; }
    .hero-cta a { width: 100%; justify-content: center; }
    .footer-content { flex-direction: column; text-align: center; }
    .vertical-timeline { padding-left: 44px; }
    .vertical-timeline::before { left: 14px; }
    .tl-left .timeline-icon, .tl-right .timeline-icon { width: 34px; height: 34px; }
    .timeline-icon svg { width: 14px; height: 14px; }
    .timeline-content-box { padding: 20px; }
    .timeline-card-header { flex-direction: column !important; }
    .timeline-date { align-self: flex-start; }
}

/* ═══════════════════════════════════════
   ROCKET BACK-TO-TOP BUTTON
   ═══════════════════════════════════════ */

.rocket-btn {
    position: fixed;
    bottom: 32px;
    right: 32px;
    z-index: 90;
    width: 56px;
    height: 80px;
    background: none;
    border: none;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.rocket-btn.visible {
    opacity: 1;
    pointer-events: all;
    transform: translateY(0);
}

.rocket-btn.launched {
    pointer-events: none;
}

/* Rocket body wrapper */
.rocket-body {
    position: relative;
    width: 48px;
    height: 64px;
    margin: 0 auto;
    filter: drop-shadow(0 4px 16px rgba(145, 94, 255, 0.4));
    transition: filter 0.3s ease;
    animation: rocketHover 2s ease-in-out infinite;
}

.rocket-btn:hover .rocket-body {
    filter: drop-shadow(0 4px 24px rgba(145, 94, 255, 0.7));
}

.rocket-svg {
    width: 100%;
    height: 100%;
}

@keyframes rocketHover {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

/* Idle flame (subtle) */
.rocket-flame {
    position: absolute;
    bottom: 2px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 24px;
    opacity: 0.6;
    transition: opacity 0.3s;
}

.rocket-btn:hover .rocket-flame {
    opacity: 1;
}

.flame-core {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 8px;
    height: 16px;
    background: linear-gradient(to bottom, #fff8e0, #fbbf24, #f59e0b, transparent);
    border-radius: 50% 50% 40% 40%;
    animation: flameFlicker 0.15s ease-in-out infinite alternate;
}

.flame-outer {
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 16px;
    height: 22px;
    background: linear-gradient(to bottom, rgba(145, 94, 255, 0.6), rgba(232, 121, 249, 0.4), transparent);
    border-radius: 50% 50% 40% 40%;
    animation: flameFlicker 0.12s ease-in-out infinite alternate-reverse;
}

@keyframes flameFlicker {
    0% { transform: translateX(-50%) scaleX(0.9) scaleY(0.95); }
    100% { transform: translateX(-50%) scaleX(1.1) scaleY(1.05); }
}

/* Launch animation */
.rocket-btn.launched .rocket-body {
    animation: rocketLaunch 1.2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.rocket-btn.launched .rocket-flame {
    opacity: 1;
    animation: flameBurst 1.2s ease-out forwards;
}

.rocket-btn.launched .flame-core,
.rocket-btn.launched .flame-outer {
    animation: none;
}

.rocket-btn.launched .flame-core {
    height: 32px;
    width: 10px;
    transition: height 0.2s;
}

.rocket-btn.launched .flame-outer {
    height: 40px;
    width: 22px;
    transition: height 0.2s;
}

@keyframes rocketLaunch {
    0% { transform: translateY(0) rotate(0deg); }
    10% { transform: translateY(4px) rotate(-2deg); }
    20% { transform: translateY(2px) rotate(1deg); }
    100% { transform: translateY(-120vh) rotate(0deg); }
}

@keyframes flameBurst {
    0% { opacity: 1; transform: translateX(-50%) scale(1); }
    30% { opacity: 1; transform: translateX(-50%) scale(1.8); }
    100% { opacity: 1; transform: translateX(-50%) scale(1.2); }
}

/* Trail canvas */
#rocket-trail-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 89;
}

/* Responsive */
@media (max-width: 768px) {
    .rocket-btn { bottom: 20px; right: 20px; width: 48px; height: 68px; }
    .rocket-body { width: 40px; height: 54px; }
}

/* Timeline Portfolio CTA */
.timeline-portfolio-cta {
    display: flex;
    justify-content: center;
    margin-top: 1rem;
    margin-bottom: 3.5rem;
}
