:root {
    --bg: #0a0a0f;
    --bg-alt: #12121a;
    --surface: #1a1a25;
    --text: #f0f0f5;
    --text-muted: #a0a0b0;
    --accent: #6366f1;
    --accent-dim: rgba(99, 102, 241, 0.15);
    --border: rgba(255, 255, 255, 0.08);
    --radius: 16px;
    --shadow: 0 20px 40px rgba(0,0,0,0.4);
}

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

html {
    scroll-behavior: smooth;
    background: var(--bg);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* Navigation */
.nav {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 32px;
    background: rgba(10, 10, 15, 0.85);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
}

.nav-brand {
    font-weight: 700;
    font-size: 1.25rem;
    letter-spacing: -0.02em;
}

.nav-links {
    display: flex;
    gap: 32px;
    list-style: none;
}

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

.nav-links a:hover,
.nav-links a.active {
    color: var(--text);
}

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

.nav-links a:hover::after,
.nav-links a.active::after {
    width: 100%;
}

/* Hero background depth */
.section.hero {
    position: relative;
    overflow: hidden;
}

.section.hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
    background-size: 60px 60px;
    pointer-events: none;
    z-index: 0;
}

.hero-glow {
    position: absolute;
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    width: 900px;
    height: 600px;
    background: radial-gradient(ellipse at 50% 0%,
        rgba(99, 102, 241, 0.22) 0%,
        rgba(56, 189, 248, 0.1) 40%,
        transparent 70%);
    pointer-events: none;
    animation: heroGlow 9s ease-in-out infinite;
    z-index: 0;
}

@keyframes heroGlow {
    0%, 100% { opacity: 0.7; transform: translateX(-50%) scaleY(1); }
    50%       { opacity: 1;   transform: translateX(-50%) scaleY(1.18); }
}

.section.hero .container {
    position: relative;
    z-index: 1;
}

/* Sections */
.section {
    min-height: 100vh;
    padding: 120px 24px 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.section.alt {
    background: var(--bg-alt);
}

.container {
    max-width: 1100px;
    width: 100%;
    margin: 0 auto;
}

h1 {
    font-size: clamp(2.5rem, 5vw, 3.5rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    text-align: center;
    margin-bottom: 8px;
    background: linear-gradient(135deg, #a78bfa 0%, #6366f1 45%, #38bdf8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

h2 {
    font-size: clamp(1.8rem, 3vw, 2.5rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 40px;
}

.subtitle {
    text-align: center;
    color: var(--text-muted);
    font-size: 1rem;
    margin-bottom: 60px;
}

/* Carousel */
.carousel-stage {
    position: relative;
    width: 100%;
    height: 520px;
    perspective: 1200px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: visible;
    touch-action: none;
    user-select: none;
    cursor: grab;
}

.carousel-stage:active {
    cursor: grabbing;
}

.carousel-orbit {
    position: relative;
    width: 300px;
    height: 380px;
    transform-style: preserve-3d;
    will-change: transform;
}

.carousel-card {
    position: absolute;
    width: 260px;
    height: 340px;
    left: 20px;
    top: 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    transition: box-shadow 0.3s, border-color 0.3s;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.carousel-card:hover {
    border-color: var(--accent);
    box-shadow: 0 0 40px rgba(99, 102, 241, 0.3);
}

.carousel-card.card-front {
    border-color: rgba(99, 102, 241, 0.75);
    box-shadow: 0 0 50px rgba(99, 102, 241, 0.45), 0 0 100px rgba(56, 189, 248, 0.12);
}

.carousel-card-media {
    width: 100%;
    height: 55%;
    object-fit: cover;
    display: block;
    background: var(--bg-alt);
}

.carousel-card-body {
    padding: 16px;
    height: 45%;
    display: flex;
    flex-direction: column;
}

.carousel-card-title {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* description removed from card — now shown in detail panel below */

.carousel-card-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: auto;
}

.tag {
    font-size: 0.75rem;
    padding: 4px 12px;
    background: var(--accent-dim);
    color: var(--accent);
    border-radius: 20px;
    border: 1px solid rgba(99, 102, 241, 0.3);
    display: inline-block;
}

/* Project detail panel */
.project-detail {
    margin-top: 48px;
    text-align: center;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.25s ease, transform 0.25s ease;
    min-height: 120px;
}

.project-detail.detail-visible {
    opacity: 1;
    transform: translateY(0);
}

.detail-title {
    font-size: 1.4rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    margin-bottom: 12px;
    color: var(--text);
}

.detail-desc {
    font-size: 0.95rem;
    color: var(--text-muted);
    line-height: 1.65;
    max-width: 620px;
    margin: 0 auto 20px;
}

.detail-tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 20px;
}

.detail-link {
    display: inline-block;
    color: var(--accent);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    border: 1px solid rgba(99, 102, 241, 0.4);
    padding: 8px 22px;
    border-radius: 20px;
    transition: background 0.25s, color 0.25s, border-color 0.25s;
}

.detail-link:hover {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.carousel-hint {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    color: var(--text-muted);
    font-size: 0.85rem;
    pointer-events: none;
}

/* About */
.about-grid {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 60px;
    align-items: start;
}

.profile-img {
    width: 100%;
    aspect-ratio: 1;
    border-radius: var(--radius);
    object-fit: cover;
    border: 2px solid var(--border);
}

.lead {
    font-size: 1.15rem;
    color: var(--text-muted);
    line-height: 1.7;
    margin-bottom: 32px;
}

.skills {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* News */
.news-grid {
    display: grid;
    gap: 20px;
}

.news-card {
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    transition: border-color 0.3s, transform 0.3s;
}

.news-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.news-date {
    font-size: 0.8rem;
    color: var(--accent);
    font-weight: 600;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.news-card h3 {
    font-size: 1.15rem;
    margin-bottom: 8px;
}

.news-card p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* Legal */
.legal-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.legal-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
}

.legal-card h3 {
    font-size: 1.1rem;
    margin-bottom: 12px;
}

.legal-card p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 16px;
}

.legal-card a {
    color: var(--accent);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
}

.legal-card a:hover {
    text-decoration: underline;
}

/* Contact */
.email-container {
    margin-top: 32px;
    position: relative;
    display: inline-block;
}

.email-btn {
    background: var(--surface);
    border: 1px solid var(--accent);
    border-radius: var(--radius);
    padding: 20px 40px;
    cursor: pointer;
    transition: all 0.3s;
    font-family: inherit;
}

.email-btn:hover {
    background: var(--accent);
    box-shadow: 0 0 40px rgba(99, 102, 241, 0.4);
}

.email-obfuscated {
    font-family: 'Courier New', monospace;
    font-size: 1.3rem;
    color: var(--accent);
    letter-spacing: 0.08em;
}

.email-btn:hover .email-obfuscated {
    color: var(--text);
}

.copy-feedback {
    position: absolute;
    top: -40px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--accent);
    color: var(--text);
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s, transform 0.3s;
}

.copy-feedback.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Scrollbar */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--surface); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* Animations */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeUp 0.6s ease forwards;
}

/* Mobile */
@media (max-width: 768px) {
    .nav { padding: 16px 20px; }
    .nav-links { gap: 16px; }
    .nav-links a { font-size: 0.8rem; }

    .section { padding: 100px 16px 60px; }

    .carousel-stage {
        height: 420px;
        perspective: 800px;
    }

    .carousel-orbit {
        width: 240px;
        height: 320px;
    }

    .carousel-card {
        width: 200px;
        height: 280px;
        left: 20px;
        top: 20px;
    }

    .about-grid {
        grid-template-columns: 1fr;
        gap: 32px;
    }

    .profile-img {
        width: 180px;
        margin: 0 auto;
        display: block;
    }

    .legal-grid {
        grid-template-columns: 1fr;
    }

    .email-obfuscated {
        font-size: 1rem;
    }
}