:root {
    --bg-color: #050505;
    --text-color: #ffffff;
    --accent-color: #ff3366;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    cursor: none;
    /* Hide default cursor for custom one */
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Custom Cursor */
.cursor {
    width: 8px;
    height: 8px;
    background: var(--accent-color);
    border-radius: 50%;
    position: fixed;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 9999;
    transform: translate(-50%, -50%);
    transition: width 0.2s, height 0.2s;
}

.cursor-follower {
    width: 40px;
    height: 40px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    position: fixed;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 9998;
    transform: translate(-50%, -50%);
    transition: transform 0.1s;
}

.cursor.hovered {
    width: 20px;
    height: 20px;
    background: rgba(255, 51, 102, 0.5);
}

/* WebGL Canvas */
#webgl {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    pointer-events: none;
}

/* Glassmorphism Utility */
.glass-panel {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.2);
    transition: background 0.3s ease, border 0.3s ease, transform 0.3s ease;
}

.glass-panel:hover {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

/* Navigation (Dock Style) */
nav {
    position: fixed;
    top: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    width: max-content;
    padding: 1rem 2.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 4rem;
    z-index: 100;
    border-radius: 50px;
}

/* Hamburger Menu */
.hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    z-index: 101;
}

.hamburger .bar {
    width: 25px;
    height: 2px;
    background: var(--text-color);
    transition: 0.3s ease;
}

.hamburger.active .bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.hamburger.active .bar:nth-child(2) {
    opacity: 0;
}

.hamburger.active .bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* Language Switcher */
.lang-switcher {
    display: flex;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.05);
    padding: 0.3rem;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.lang-btn {
    background: transparent;
    border: none;
    color: var(--text-color);
    padding: 0.4rem 0.8rem;
    border-radius: 15px;
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
    opacity: 0.5;
    transition: all 0.3s ease;
    cursor: pointer;
}

.lang-btn.active,
.lang-btn:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.15);
}

.logo {
    font-family: 'Syncopate', sans-serif;
    font-weight: 700;
    font-size: 1.5rem;
    letter-spacing: 2px;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 3rem;
    align-items: center;
}

.nav-links a {
    color: var(--text-color);
    text-decoration: none;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    position: relative;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0%;
    height: 1px;
    background: var(--text-color);
    transition: width 0.3s ease;
}

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

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

/* Sections */
section {
    min-height: 100vh;
    padding: 100px 0;
    position: relative;
}

/* Hero Section */
.hero {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.hero-content h1 {
    font-family: 'Syncopate', sans-serif;
    font-size: 8vw;
    line-height: 1.1;
    font-weight: 700;
    text-transform: uppercase;
    position: relative;
}

.hero-content p {
    font-size: 1.2rem;
    max-width: 600px;
    margin: 2rem auto;
    opacity: 0.8;
}

.cta-btn {
    display: inline-block;
    padding: 1rem 2.5rem;
    border: 1px solid var(--text-color);
    color: var(--text-color);
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 2px;
    border-radius: 50px;
    position: relative;
    overflow: hidden;
    transition: color 0.3s;
}

.cta-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--text-color);
    z-index: -1;
    transform: scaleX(0);
    transform-origin: right;
    transition: transform 0.3s ease;
}

.cta-btn:hover {
    color: var(--bg-color);
}

.cta-btn:hover::before {
    transform: scaleX(1);
    transform-origin: left;
}

/* Glitch Effect */
.glitch {
    position: relative;
}

.glitch::before,
.glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-color);
}

.glitch::before {
    left: 2px;
    text-shadow: -2px 0 red;
    clip: rect(44px, 450px, 56px, 0);
    animation: glitch-anim 5s infinite linear alternate-reverse;
}

.glitch::after {
    left: -2px;
    text-shadow: -2px 0 blue;
    clip: rect(44px, 450px, 56px, 0);
    animation: glitch-anim2 5s infinite linear alternate-reverse;
}

@keyframes glitch-anim {
    0% {
        clip: rect(21px, 9999px, 86px, 0);
    }

    20% {
        clip: rect(69px, 9999px, 12px, 0);
    }

    40% {
        clip: rect(98px, 9999px, 35px, 0);
    }

    60% {
        clip: rect(15px, 9999px, 91px, 0);
    }

    80% {
        clip: rect(82px, 9999px, 4px, 0);
    }

    100% {
        clip: rect(43px, 9999px, 78px, 0);
    }
}

@keyframes glitch-anim2 {
    0% {
        clip: rect(86px, 9999px, 21px, 0);
    }

    20% {
        clip: rect(12px, 9999px, 69px, 0);
    }

    40% {
        clip: rect(35px, 9999px, 98px, 0);
    }

    60% {
        clip: rect(91px, 9999px, 15px, 0);
    }

    80% {
        clip: rect(4px, 9999px, 82px, 0);
    }

    100% {
        clip: rect(78px, 9999px, 43px, 0);
    }
}

.scroll-indicator {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    opacity: 0.6;
}

.scroll-indicator span {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.scroll-indicator .line {
    width: 1px;
    height: 60px;
    background: linear-gradient(to bottom, var(--text-color), transparent);
}

/* Common Section */
.section-title {
    font-family: 'Syncopate', sans-serif;
    font-size: 3rem;
    margin-bottom: 3rem;
    opacity: 0;
    transform: translateY(50px);
    text-shadow: 0 4px 15px rgba(0, 0, 0, 0.8);
}

/* About */
.about {
    /* Menghapus flex center agar konten yang panjang tidak meluap ke atas menutupi navbar */
    padding-top: 150px;
}

.about-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: start;
}

.about-text {
    font-size: 2rem;
    line-height: 1.4;
    font-weight: 300;
}

.reveal-text {
    opacity: 0.3;
}

/* Experience List */
.experience-list {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.experience-item {
    transition: transform 0.3s ease;
    border-top: none;
}

.experience-item:hover {
    transform: translateX(10px);
}

.experience-item .year {
    color: var(--accent-color);
    font-size: 0.9rem;
    letter-spacing: 1px;
    font-family: 'Syncopate', sans-serif;
    margin-bottom: 0.5rem;
    display: block;
}

.experience-item h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.experience-item p {
    opacity: 0.7;
    font-size: 1.1rem;
}

/* Works */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 3rem;
}

.project-card {
    position: relative;
    overflow: hidden;
    border-radius: 10px;
    opacity: 0;
    transform: translateY(50px);
}

.project-image {
    width: 100%;
    height: 400px;
    overflow: hidden;
}

.project-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.7s ease;
}

/* Grid Layouts for Multiple Images */
.project-image.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2px;
}

.project-image.grid-3 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 2px;
}

.project-image.grid-3 img:first-child {
    grid-column: span 2;
}

.project-image.grid-4 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 2px;
}

.project-card:hover .project-image img {
    transform: scale(1.1);
}

.project-info {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 2rem;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
    transform: translateY(100%);
    transition: transform 0.4s ease;
}

.project-card:hover .project-info {
    transform: translateY(0);
}

.project-info h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

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

.card-badges img {
    height: 20px;
    width: auto;
    border-radius: 3px;
    opacity: 0.9;
}

.card-badges img:hover {
    opacity: 1;
    transform: translateY(-2px);
    transition: all 0.2s ease;
}

/* Contact */
.contact {
    display: flex;
    align-items: center;
    text-align: center;
}

.contact .section-title {
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    margin-bottom: 0.5rem;
}

.contact .container {
    width: 100%;
}

.email-link {
    font-family: 'Syncopate', sans-serif;
    font-size: clamp(1.2rem, 4vw, 3.5rem);
    color: var(--text-color);
    text-decoration: none;
    display: block;
    margin: 1.5rem 0;
    transition: color 0.3s;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.8), 0 0 40px rgba(0, 0, 0, 0.5);
    word-break: break-all;
    line-height: 1.2;
}

.email-link:hover {
    color: var(--accent-color);
    -webkit-text-stroke: 1px var(--text-color);
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 2rem;
    overflow: hidden;
    /* Prevent modal container itself from scrolling */
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
}

.modal-content {
    position: relative;
    width: 98%;
    max-height: 95vh;
    z-index: 1001;
    border-radius: 24px;
    padding: 0.5rem;
    overflow: hidden;
}

.modal-scroll-area {
    max-height: 92vh;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 2.5rem;
    padding-right: 1.5rem;
    border-radius: 18px;
    scrollbar-width: thin;
    scrollbar-color: var(--accent-color) transparent;
}

.modal-scroll-area::-webkit-scrollbar {
    width: 6px;
}

.modal-scroll-area::-webkit-scrollbar-track {
    background: transparent;
}

.modal-scroll-area::-webkit-scrollbar-thumb {
    background-color: var(--accent-color);
    border-radius: 20px;
}

.modal-close {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    background: transparent;
    border: none;
    color: var(--text-color);
    font-size: 2.5rem;
    cursor: pointer;
    transition: transform 0.3s ease;
    z-index: 1002;
}

.modal-close:hover {
    transform: rotate(90deg) scale(1.1);
}

.modal-body {
    display: block; /* Removed grid to allow natural block flow */
    width: 100%;
}

.modal-image-container {
    width: 100%;
    border-radius: 20px;
    overflow: hidden;
    aspect-ratio: 4/3;
}

.modal-image-container img {
    width: 100%;
    height: 100%;
    object-fit: crop;
}

/* Sembunyikan container gambar jika src kosong (untuk experience) */
.modal-image-container:has(img[src=""]) {
    display: none;
}

/* Jika gambar disembunyikan, buat teks menjadi 1 kolom penuh */
.modal-body:has(.modal-image-container:not(:visible)) {
    grid-template-columns: 1fr;
}

.modal-text h2 {
    font-family: 'Syncopate', sans-serif;
    font-size: 2rem;
    margin-bottom: 1rem;
}

.modal-subtitle {
    font-weight: 700;
    color: var(--accent-color);
    margin-bottom: 2rem;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.modal-description {
    line-height: 1.8;
    font-size: 1.1rem;
    opacity: 0.9;
    width: 100%;
}

/* Markdown Styling in Modal */
.markdown-body {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-color);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-wrap: break-word !important; /* Critical for long titles on mobile */
    word-wrap: break-word !important;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3 {
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    font-family: 'Syncopate', sans-serif;
    color: var(--accent-color);
}

.markdown-body h1 {
    font-size: 1.8rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 0.5rem;
}

.markdown-body h2 {
    font-size: 1.4rem;
}

.markdown-body h3 {
    font-size: 1.2rem;
}

.markdown-body p {
    margin-bottom: 1rem;
    opacity: 0.8;
}

.markdown-body ul,
.markdown-body ol {
    margin-bottom: 1.5rem;
    padding-left: 1.5rem;
}

.markdown-body li {
    margin-bottom: 0.5rem;
    opacity: 0.8;
}

.markdown-body code {
    background: rgba(255, 255, 255, 0.1);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: monospace;
}

.markdown-body img {
    max-width: 100% !important;
    height: auto;
    border-radius: 12px;
    margin: 0.5rem 0.5rem 0.5rem 0;
    display: inline-block;
    /* Changed from block to allow badges to be horizontal */
    vertical-align: middle;
}

.markdown-body table {
    width: 100%;
    margin-bottom: 1.5rem;
    border-collapse: collapse;
    table-layout: fixed;
    /* Force table to respect container width */
}

.markdown-body td,
.markdown-body th {
    padding: 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.markdown-body td img {
    max-width: 100% !important;
    height: auto !important;
    display: block;
}

@media (max-width: 768px) {
    .modal-body {
        display: block;
    }

    .modal {
        padding: 0;
        /* No padding for full-screen feel on mobile */
    }

    .modal-content {
        width: 100%;
        height: 100%;
        max-height: 100vh;
        border-radius: 0;
        padding: 0;
    }

    .modal-scroll-area {
        max-height: 100vh;
        padding: 4rem 1.5rem 2rem 1.5rem;
        border-radius: 0;
    }

    .modal-close {
        top: 1rem;
        right: 1rem;
        width: 40px;
        height: 40px;
        font-size: 1.5rem;
        background: rgba(0, 0, 0, 0.5);
        backdrop-filter: blur(5px);
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        z-index: 1005;
        /* Above everything */
    }

    .markdown-body h1 {
        font-size: 1.5rem;
    }

    .markdown-body h2 {
        font-size: 1.2rem;
    }

    .markdown-body h3 {
        font-size: 1.1rem;
    }

    .markdown-body {
        font-size: 0.95rem;
    }
}

footer {
    margin-top: 50px;
    opacity: 0.5;
    font-size: 0.9rem;
}

/* Responsive */
@media (max-width: 768px) {
    nav {
        width: 90%;
        padding: 1rem 1.5rem;
        gap: 0;
        /* Remove invalid gap auto */
    }

    .section-title {
        font-size: 2rem;
        /* Prevents overflow */
        margin-bottom: 2rem;
    }

    .hamburger {
        display: flex;
    }

    .nav-links {
        display: flex;
        flex-direction: column;
        position: fixed;
        /* Compensate for nav container offset (top: 1.5rem, left edge at 5vw) */
        top: -1.5rem;
        left: -5vw;
        width: 100vw;
        height: 100vh;
        background: rgba(5, 5, 5, 0.95);
        backdrop-filter: blur(15px);
        -webkit-backdrop-filter: blur(15px);
        justify-content: center;
        align-items: center;
        gap: 3rem;
        /* Must be positive or it hides behind the parent glass-panel */
        z-index: 99;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.4s ease, visibility 0.4s ease;
    }

    .nav-links.active {
        opacity: 1 !important;
        visibility: visible !important;
    }

    .nav-links li {
        opacity: 0;
        transform: translateY(20px);
        transition: opacity 0.4s ease, transform 0.4s ease;
    }

    .nav-links.active li {
        opacity: 1 !important;
        transform: translateY(0) !important;
    }

    /* Staggered animation for menu items */
    .nav-links.active li:nth-child(1) {
        transition-delay: 0.1s;
    }

    .nav-links.active li:nth-child(2) {
        transition-delay: 0.2s;
    }

    .nav-links.active li:nth-child(3) {
        transition-delay: 0.3s;
    }

    .nav-links.active li:nth-child(4) {
        transition-delay: 0.4s;
    }

    .nav-links.active li:nth-child(5) {
        transition-delay: 0.5s;
    }

    .nav-links a {
        font-size: 1.5rem;
    }

    .lang-btn {
        padding: 0.5rem 1rem;
        font-size: 1.2rem;
    }

    .hero-content h1 {
        font-size: 12vw;
    }

    .about-split {
        grid-template-columns: 1fr;
        gap: 3rem;
    }

    .about-text {
        font-size: 1.5rem;
    }

    .project-image {
        height: 300px;
    }

    .cursor,
    .cursor-follower {
        display: none;
    }

    * {
        cursor: auto;
    }
}