:root {
    --bg-primary: #09090b;
    --bg-secondary: #18181b;
    --bg-tertiary: #27272a;
    --text-primary: #fafafa;
    --text-secondary: #a1a1aa;
    --text-tertiary: #71717a;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --border: #27272a;
    --success: #10b981;
    --danger: #ef4444;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

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

/* Navigation */
.nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(9, 9, 11, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border) !important;
    z-index: 1000;
}

.nav-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
}

.nav-logo {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent), #8b5cf6) !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    background-clip: text !important;
}

.mono {
    font-family: 'JetBrains Mono', monospace;
}

.nav-links {
    display: flex;
    gap: 2rem;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.3s ease;
}

.nav-link:hover {
    color: var(--text-primary);
}

.admin-link {
    color: var(--accent) !important;
}

/* Hero Section */
.hero {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

#tech-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

.hero-content {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 2rem;
}

.hero-name {
    font-size: 4rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: #fafafa !important;
    -webkit-text-fill-color: #fafafa !important;
    animation: fadeInUp 0.8s ease;
}

.hero-title {
    font-size: 1.5rem;
    color: var(--accent);
    margin-bottom: 1rem;
    font-weight: 500;
    animation: fadeInUp 0.8s ease 0.2s both;
}

.hero-tagline {
    font-size: 1.1rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto 2rem;
    animation: fadeInUp 0.8s ease 0.4s both;
}

.hero-cta {
    display: flex;
    gap: 1rem;
    justify-content: center;
    animation: fadeInUp 0.8s ease 0.6s both;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Buttons */
.btn {
    padding: 0.75rem 2rem;
    border-radius: 0.5rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    font-size: 1rem;
}

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(59, 130, 246, 0.3);
}

.btn-secondary {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg-secondary);
    border-color: var(--accent);
    transform: translateY(-2px);
}

/* Sections */
.section {
    padding: 6rem 0;
}

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

.section-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 3rem;
    text-align: center;
    background: linear-gradient(135deg, var(--text-primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* About Section */
.about-content {
    max-width: 800px;
    margin: 0 auto;
}

.about-content p {
    margin-bottom: 1.5rem;
    color: var(--text-secondary);
    font-size: 1.1rem;
    line-height: 1.8;
}

/* Timeline */
.timeline {
    max-width: 800px;
    margin: 0 auto;
    position: relative;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border);
}

.timeline-item {
    position: relative;
    padding-left: 3rem;
    margin-bottom: 3rem;
}

.timeline-dot {
    position: absolute;
    left: -6px;
    top: 0;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 4px var(--bg-secondary);
}

.timeline-date {
    color: var(--accent);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.timeline-content h3 {
    font-size: 1.3rem;
    margin-bottom: 0.25rem;
    color: var(--text-primary);
}

.timeline-company {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 0.75rem;
}

.timeline-content p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.timeline-achievements {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

.achievement-tag {
    padding: 0.25rem 0.75rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 1rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Portfolio Grid */
.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 2rem;
}

.project-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 1rem;
    overflow: hidden;
    transition: all 0.3s ease;
    cursor: pointer;
}

.project-card:hover {
    transform: translateY(-4px);
    border-color: var(--accent);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.project-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: var(--bg-tertiary);
}

.project-content {
    padding: 1.5rem;
}

.project-title {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.project-featured {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background: linear-gradient(135deg, var(--accent), #8b5cf6);
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 0.5rem;
}

.project-description {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    line-height: 1.6;
}

.project-tech {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tech-tag {
    padding: 0.25rem 0.75rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 0.25rem;
    font-size: 0.8rem;
    color: var(--accent);
    font-family: 'JetBrains Mono', monospace;
}

/* Skills Grid */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}

.skill-category {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
    transition: background 0.2s ease;
}

.skill-category:hover {
    background: rgba(255,255,255,0.02);
}

.skill-category h3 {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 0.75rem;
}

.skill-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.skill-tag {
    padding: 0.5rem 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
    transition: all 0.3s ease;
}

.skill-tag:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* Contact Section */
.contact-content {
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
}

.contact-intro {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.contact-links {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.contact-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 1rem 2rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 1.1rem;
    transition: all 0.3s ease;
}

.contact-link:hover {
    border-color: var(--accent);
    transform: translateX(4px);
}

.contact-link svg {
    flex-shrink: 0;
}

/* Footer */
.footer {
    padding: 2rem 0;
    text-align: center;
    border-top: 1px solid var(--border);
    color: var(--text-tertiary);
    font-size: 0.9rem;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    z-index: 2000;
    padding: 2rem;
    overflow-y: auto;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 1rem;
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    padding: 2rem;
    animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--text-secondary);
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.modal h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.modal h3 {
    font-size: 1.5rem;
    margin: 2rem 0 1rem;
    color: var(--accent);
}

.modal p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    line-height: 1.8;
}

.modal h4 {
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
    margin: 1.5rem 0 0.5rem;
}

.modal ul {
    list-style: disc;
    padding-left: 1.5rem;
    margin-bottom: 1rem;
}

.modal li {
    color: var(--text-secondary);
    line-height: 1.8;
    padding-left: 0.25rem;
}

.modal img {
    width: 100%;
    border-radius: 0.5rem;
    margin: 1rem 0;
}

.project-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin: 2rem 0;
    padding: 1.5rem;
    background: var(--bg-primary);
    border-radius: 0.5rem;
}

.project-meta-item {
    flex: 1;
    min-width: 200px;
}

.project-meta-label {
    font-size: 0.85rem;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

.project-meta-value {
    color: var(--text-primary);
}

.project-meta-value a {
    color: var(--accent);
    text-decoration: none;
}

.project-meta-value a:hover {
    text-decoration: underline;
}

/* Admin Panel */
.admin-panel {
    max-width: 1200px;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.admin-projects {
    display: grid;
    gap: 1rem;
}

.admin-project-item {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: start;
}

.admin-project-info h3 {
    margin-bottom: 0.5rem;
}

.admin-project-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1rem;
}

.form-group textarea {
    min-height: 200px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.checkbox-group input {
    width: auto;
}

/* Login Form */
.login-form {
    max-width: 400px;
    margin: 0 auto;
}

.login-form h2 {
    text-align: center;
    margin-bottom: 2rem;
}

.error-message {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--danger);
    color: var(--danger);
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
}

/* Responsive */
@media (max-width: 768px) {
    .hero-name {
        font-size: 2.5rem;
    }

    .hero-title {
        font-size: 1.2rem;
    }

    .nav-links {
        gap: 1rem;
        font-size: 0.85rem;
    }

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

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

    .section-title {
        font-size: 2rem;
    }

    .modal-content {
        padding: 1.5rem;
    }

    .timeline::before {
        left: 0;
    }

    .timeline-item {
        padding-left: 2rem;
    }
}

/* Gallery */
.gallery {
    margin-bottom: 1.5rem;
}

.gallery-main {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    background: #18181b;
}

.gallery-main a {
    display: block;
    position: relative;
}

.gallery-hero {
    width: 100%;
    aspect-ratio: 16/9;
    object-fit: cover;
    display: block;
    cursor: zoom-in;
    transition: transform 0.3s ease;
}

.gallery-main a:hover .gallery-hero {
    transform: scale(1.02);
}

.gallery-zoom-hint {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(0,0,0,0.6);
    color: #fff;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
    backdrop-filter: blur(4px);
}

.gallery-main a:hover .gallery-zoom-hint {
    opacity: 1;
}

.gallery-thumbs {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: thin;
    scrollbar-color: #3f3f46 transparent;
}

.gallery-thumb-link {
    flex-shrink: 0;
    border-radius: 6px;
    overflow: hidden;
    border: 2px solid transparent;
    opacity: 0.5;
    transition: all 0.2s ease;
}

.gallery-thumb-link.active {
    border-color: #3b82f6;
    opacity: 1;
}

.gallery-thumb-link:hover {
    opacity: 0.8;
}

.gallery-thumb {
    width: 80px;
    height: 54px;
    object-fit: cover;
    display: block;
    cursor: pointer;
}

.gallery-count {
    text-align: center;
    margin-top: 8px;
    font-size: 0.75rem;
    color: #71717a;
}

/* ── Scroll Animations ── */
.anim {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}
.anim.slide-left {
    transform: translateX(-32px);
}
.anim.slide-right {
    transform: translateX(32px);
}
.anim.visible {
    opacity: 1;
    transform: none;
}

/* Stagger children */
.stagger > .anim:nth-child(1) { transition-delay: 0s; }
.stagger > .anim:nth-child(2) { transition-delay: 0.08s; }
.stagger > .anim:nth-child(3) { transition-delay: 0.16s; }
.stagger > .anim:nth-child(4) { transition-delay: 0.24s; }
.stagger > .anim:nth-child(5) { transition-delay: 0.32s; }
.stagger > .anim:nth-child(6) { transition-delay: 0.4s; }
.stagger > .anim:nth-child(7) { transition-delay: 0.48s; }
.stagger > .anim:nth-child(8) { transition-delay: 0.56s; }
.stagger > .anim:nth-child(9) { transition-delay: 0.64s; }
.stagger > .anim:nth-child(10) { transition-delay: 0.72s; }

/* Skill tags stagger */
.skill-tags.stagger .skill-tag.anim:nth-child(1) { transition-delay: 0s; }
.skill-tags.stagger .skill-tag.anim:nth-child(2) { transition-delay: 0.04s; }
.skill-tags.stagger .skill-tag.anim:nth-child(3) { transition-delay: 0.08s; }
.skill-tags.stagger .skill-tag.anim:nth-child(4) { transition-delay: 0.12s; }
.skill-tags.stagger .skill-tag.anim:nth-child(5) { transition-delay: 0.16s; }
.skill-tags.stagger .skill-tag.anim:nth-child(6) { transition-delay: 0.20s; }
.skill-tags.stagger .skill-tag.anim:nth-child(7) { transition-delay: 0.24s; }
.skill-tags.stagger .skill-tag.anim:nth-child(8) { transition-delay: 0.28s; }

/* ── Dynamic Timeline ── */
.timeline-dynamic {
    position: relative;
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 0;
}

.timeline-line {
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border);
    transform: translateX(-50%);
}

.timeline-line-fill {
    position: absolute;
    left: 50%;
    top: 0;
    width: 2px;
    height: 0;
    background: linear-gradient(180deg, var(--accent), #8b5cf6);
    transform: translateX(-50%);
    transition: height 0.1s linear;
}

.tl-entry {
    position: relative;
    display: flex;
    width: 100%;
    margin-bottom: 3rem;
}

.tl-entry:nth-child(odd) {
    justify-content: flex-start;
    padding-right: calc(50% + 2rem);
}

.tl-entry:nth-child(even) {
    justify-content: flex-end;
    padding-left: calc(50% + 2rem);
}

.tl-entry:nth-child(odd) .tl-badges {
    justify-content: flex-end;
}

.tl-entry:nth-child(odd) {
    text-align: right;
}

.tl-dot {
    position: absolute;
    left: 50%;
    top: 0.5rem;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--bg-secondary);
    border: 2px solid var(--border);
    transform: translateX(-50%);
    z-index: 2;
    transition: all 0.4s ease;
}

.tl-entry.visible .tl-dot {
    border-color: var(--accent);
    background: var(--accent);
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.5), 0 0 24px rgba(59, 130, 246, 0.2);
}

.tl-card {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 1.25rem;
    transition: all 0.3s ease;
    width: 100%;
    position: relative;
    z-index: 1;
}

.tl-card:hover {
    border-color: rgba(59, 130, 246, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.tl-date {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    color: var(--accent);
    margin-bottom: 0.5rem;
}

.tl-card h3 {
    font-size: 1.2rem;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.tl-company {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
}

.tl-desc {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 0.75rem;
    max-height: 4.8em;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.tl-card:hover .tl-desc {
    max-height: 20em;
}

.tl-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.tl-type-badge {
    font-size: 0.75rem;
    padding: 0.2rem 0.6rem;
    border-radius: 1rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.tl-type-badge.work {
    background: rgba(59, 130, 246, 0.1);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.tl-type-badge.project {
    background: rgba(167, 139, 250, 0.1);
    color: #a78bfa;
    border: 1px solid rgba(167, 139, 250, 0.2);
}

.tl-type-badge.education {
    background: rgba(52, 211, 153, 0.1);
    color: #34d399;
    border: 1px solid rgba(52, 211, 153, 0.2);
}

.achievement-tag {
    padding: 0.25rem 0.75rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 1rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Mobile timeline */
@media (max-width: 768px) {
    .timeline-line,
    .timeline-line-fill {
        left: 1rem;
        transform: none;
    }
    .timeline-line,
    .timeline-line-fill {
        left: 1rem;
        transform: none;
    }
    .tl-entry:nth-child(odd),
    .tl-entry:nth-child(even) {
        justify-content: flex-start;
        padding-left: 3rem;
        padding-right: 0;
        text-align: left;
    }
    .tl-entry:nth-child(odd) .tl-badges {
        justify-content: flex-start;
    }
    .tl-dot {
        left: 1rem;
    }
    .tl-dot {
        left: 1rem;
        transform: translateX(-50%);
    }
}
