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

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

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: 4vw;
    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: 16px;
    opacity: 0;
    transform: translateY(50px);
    display: flex;
    flex-direction: column;
    transition: transform 0.4s ease, border-color 0.4s ease, box-shadow 0.4s ease;
}

.project-card:hover {
    transform: translateY(-6px);
}

.project-image {
    position: relative;
    width: 100%;
    height: 250px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.02);
    display: flex;
    align-items: center;
    justify-content: center;
}

.project-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Device Pairing Layout (Full Desktop + Centered Floating Mobile Overlay) */
.project-image.grid-2 {
    display: block;
    position: relative;
}

.project-image.grid-2 img:first-child {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    display: block;
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.project-image.grid-2 img:last-child {
    position: absolute;
    height: 78%;
    width: auto;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    object-fit: contain;
    filter: drop-shadow(0 15px 30px rgba(0, 0, 0, 0.8));
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 2;
}

.project-card:hover .project-image.grid-2 img:first-child {
    transform: scale(1.03);
}

.project-card:hover .project-image.grid-2 img:last-child {
    transform: translate(-50%, -55%) scale(1.08);
}

.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-info {
    position: relative;
    width: 100%;
    padding: 1.25rem 1.5rem 1.5rem;
    background: rgba(255, 255, 255, 0.02);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.project-info h3 {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    margin-bottom: 0.75rem;
    color: var(--text-color);
}

.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;
    word-break: break-word;
    overflow-wrap: anywhere;
}

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

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

/* 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;
    word-break: break-word;
    overflow-wrap: anywhere !important; /* Critical for long titles, URLs, and code */
}

.markdown-body * {
    max-width: 100%;
    box-sizing: border-box;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    font-family: 'Syncopate', sans-serif;
    color: var(--accent-color);
    word-break: break-word;
    overflow-wrap: anywhere;
    line-height: 1.3;
}

.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 h4 {
    font-size: 1.1rem;
}

.markdown-body p {
    margin-bottom: 1rem;
    opacity: 0.8;
    word-break: break-word;
    overflow-wrap: anywhere;
}

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

.markdown-body li {
    margin-bottom: 0.5rem;
    opacity: 0.8;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.markdown-body a {
    color: var(--accent-color);
    word-break: break-word;
    overflow-wrap: anywhere;
    text-decoration: underline;
    text-underline-offset: 3px;
    transition: opacity 0.2s ease;
}

.markdown-body a:hover {
    opacity: 0.8;
}

.markdown-body code {
    background: rgba(255, 255, 255, 0.1);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: 'Fira Code', Consolas, Monaco, monospace;
    font-size: 0.9em;
    word-break: break-word;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.markdown-body pre {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 1rem;
    margin: 1.25rem 0;
    max-width: 100%;
    overflow-x: auto;
    white-space: pre-wrap; /* Wrap long commands/scripts */
    word-break: break-word;
    overflow-wrap: anywhere;
    font-family: 'Fira Code', Consolas, Monaco, monospace;
    font-size: 0.9rem;
    line-height: 1.5;
}

.markdown-body pre code {
    background: transparent;
    padding: 0;
    border-radius: 0;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-wrap: anywhere;
    font-size: inherit;
    display: block;
}

.markdown-body blockquote {
    margin: 1.25rem 0;
    padding: 0.75rem 1.25rem;
    border-left: 4px solid var(--accent-color);
    background: rgba(255, 255, 255, 0.03);
    border-radius: 0 8px 8px 0;
    word-break: break-word;
    overflow-wrap: anywhere;
    opacity: 0.9;
}

.markdown-body blockquote p {
    margin-bottom: 0;
}

.markdown-body hr {
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin: 2rem 0;
}

.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 */
    word-break: break-word;
    overflow-wrap: anywhere;
}

.markdown-body td,
.markdown-body th {
    padding: 0.6rem 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    word-break: break-word;
    overflow-wrap: anywhere;
    hyphens: auto;
    font-size: 0.9rem;
    line-height: 1.4;
}

.markdown-body th {
    background: rgba(255, 255, 255, 0.05);
    font-weight: 700;
}

.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;
    }

    .markdown-body pre {
        padding: 0.75rem;
        font-size: 0.8rem;
    }

    .markdown-body td,
    .markdown-body th {
        padding: 0.4rem;
        font-size: 0.78rem;
    }
}

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: 6vw;
    }

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

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

    .project-image {
        height: 230px;
    }

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

    * {
        cursor: auto;
    }
}

/* ============================================================
   THEME TOGGLE (3-state: dark / light / system)
   New elements only — existing dark-mode rules above untouched.
   ============================================================ */
.theme-switcher-container {
    display: flex;
    align-items: center;
}

.theme-toggle {
    position: relative;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-color);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    cursor: pointer;
    transition: width 0.3s ease, border-radius 0.3s ease, background 0.3s ease, gap 0.3s ease;
    overflow: hidden;
    white-space: nowrap;
    font-family: 'Inter', sans-serif;
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* Expand to pill + reveal text label (hover-capable devices only) */
@media (hover: hover) and (pointer: fine) {
    .theme-toggle:hover {
        width: 118px;
        border-radius: 24px;
        gap: 8px;
    }

    .theme-toggle:hover .theme-label {
        max-width: 80px;
        opacity: 1;
    }
}

.theme-toggle .theme-label {
    max-width: 0;
    opacity: 0;
    overflow: hidden;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: capitalize;
    transition: max-width 0.3s ease, opacity 0.25s ease;
}

.theme-toggle .theme-icon {
    display: flex;
    flex: none;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease, transform 0.3s ease;
    line-height: 1;
    color: inherit;
}

.theme-toggle .theme-icon svg {
    width: 20px;
    height: 20px;
    display: block;
}

.theme-toggle .theme-icon.hidden {
    opacity: 0;
    transform: scale(0.5) rotate(-90deg);
}

.theme-toggle .theme-icon.visible {
    opacity: 1;
    transform: scale(1) rotate(0deg);
}

/* ============================================================
   LIGHT MODE
   Only matches html[data-theme="light"]. Placed last so these
   rules always win for light mode. Dark mode above untouched.
   ============================================================ */
html[data-theme="light"] {
    --bg-color: #ffffff;
    --text-color: #000000;
    color-scheme: light;
}

html[data-theme="dark"] {
    color-scheme: dark;
}

html[data-theme="light"],
html[data-theme="light"] body {
    background-color: #ffffff !important;
    color: #000000 !important;
}

html[data-theme="light"] body {
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Text elements: pure black */
html[data-theme="light"] .logo,
html[data-theme="light"] .nav-links a,
html[data-theme="light"] .hero-content p,
html[data-theme="light"] .about-text,
html[data-theme="light"] .reveal-text,
html[data-theme="light"] .scroll-indicator span,
html[data-theme="light"] footer,
html[data-theme="light"] footer p,
html[data-theme="light"] .markdown-body,
html[data-theme="light"] .modal-description {
    color: #000000;
}

html[data-theme="light"] .nav-links a::after {
    background: #000000;
}

html[data-theme="light"] .hamburger .bar {
    background: #000000;
}

/* Frosted-white panels.
   NOTE: solid opaque white + NO backdrop-filter on purpose.
   On some Linux GPU/driver stacks, backdrop-filter over a WebGL
   canvas mis-composites (renders dark), making light panels look
   black/grey even though computed styles are correct. */
html[data-theme="light"] .glass-panel {
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.06);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

html[data-theme="light"] .glass-panel:hover {
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.15);
}

html[data-theme="light"] nav.glass-panel {
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.08);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

html[data-theme="light"] .project-card.glass-panel {
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

html[data-theme="light"] .project-info {
    background: rgba(0, 0, 0, 0.02);
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}

/* Controls */
html[data-theme="light"] .cursor-follower {
    border-color: rgba(0, 0, 0, 0.4);
}

html[data-theme="light"] .lang-switcher {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.1);
}

html[data-theme="light"] .lang-btn {
    color: #000000;
}

html[data-theme="light"] .lang-btn.active,
html[data-theme="light"] .lang-btn:hover {
    background: rgba(0, 0, 0, 0.1);
    color: #000000;
}

html[data-theme="light"] .theme-toggle {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.1);
    color: #000000;
}

html[data-theme="light"] .theme-toggle:hover {
    background: rgba(0, 0, 0, 0.1);
}

/* Hero */
html[data-theme="light"] .glitch {
    color: #000000;
}

html[data-theme="light"] .glitch::before,
html[data-theme="light"] .glitch::after {
    background: #ffffff;
    color: #000000;
}

html[data-theme="light"] .scroll-indicator .line {
    background: linear-gradient(to bottom, #000000, transparent);
}

html[data-theme="light"] .cta-btn {
    border-color: #000000;
    color: #000000;
}

html[data-theme="light"] .cta-btn:hover {
    color: #ffffff;
}

html[data-theme="light"] .cta-btn::before {
    background: #000000;
}

/* Sections */
html[data-theme="light"] .section-title {
    color: #000000;
    text-shadow: none !important;
}

html[data-theme="light"] .experience-item h3 {
    color: #000000;
}

html[data-theme="light"] .experience-item p {
    color: rgba(0, 0, 0, 0.7);
}

html[data-theme="light"] .experience-item .year {
    color: var(--accent-color);
}

html[data-theme="light"] .project-info {
    background: linear-gradient(to top, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.75), transparent);
}

html[data-theme="light"] .project-info h3,
html[data-theme="light"] .project-info p {
    color: #000000;
}

html[data-theme="light"] .email-link {
    color: #000000;
    text-shadow: none !important;
}

/* Modal + markdown */
html[data-theme="light"] .modal-overlay {
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

html[data-theme="light"] .modal-content.glass-panel {
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

html[data-theme="light"] .modal-close {
    color: #000000;
}

html[data-theme="light"] .markdown-body h1 {
    border-bottom-color: rgba(0, 0, 0, 0.1);
}

html[data-theme="light"] .markdown-body code {
    background: rgba(0, 0, 0, 0.06);
    color: #000000;
}

html[data-theme="light"] .markdown-body pre {
    background: rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(0, 0, 0, 0.1);
    color: #000000;
}

html[data-theme="light"] .markdown-body pre code {
    background: transparent;
    color: #000000;
}

html[data-theme="light"] .markdown-body blockquote {
    background: rgba(0, 0, 0, 0.03);
    border-left-color: var(--accent-color);
    color: #000000;
}

html[data-theme="light"] .markdown-body hr {
    border-top-color: rgba(0, 0, 0, 0.1);
}

html[data-theme="light"] .markdown-body td,
html[data-theme="light"] .markdown-body th {
    border-color: rgba(0, 0, 0, 0.1);
    color: #000000;
}

html[data-theme="light"] .markdown-body th {
    background: rgba(0, 0, 0, 0.03);
}

html[data-theme="light"] .markdown-body p,
html[data-theme="light"] .markdown-body li {
    color: #000000;
}

/* Mobile */
@media (max-width: 768px) {
    html[data-theme="light"] .nav-links {
        background: #ffffff;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }

    html[data-theme="light"] .modal-close {
        background: rgba(255, 255, 255, 0.8);
        border: 1px solid rgba(0, 0, 0, 0.1);
    }

    .theme-toggle {
        width: 48px;
        height: 48px;
        font-size: 1.4rem;
    }

    .theme-toggle .theme-icon svg {
        width: 22px;
        height: 22px;
    }
}