html {
    overflow-x: hidden;
}

/* === THEME VARIABLES === */
:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f1f5f9;
    --bg-card: #ffffff;
    --bg-header: rgba(255, 255, 255, 0.7);
    --bg-mobile-menu: #ffffff;
    --bg-skill-item: #ffffff;
    --bg-message-feed: #f1f5f9;
    --bg-message-bubble: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --border-color: #cbd5e1;
    --hover-bg-secondary: #e2e8f0;
    --skill-icon-bg: #e0f2fe;
    --skill-icon-color: #3b82f6;
}

html.dark {
    --bg-primary: #0f172a;
    --bg-secondary: #334155;
    --bg-card: #1e293b;
    --bg-header: rgba(15, 23, 42, 0.7);
    --bg-mobile-menu: #1e293b;
    --bg-skill-item: #334155;
    --bg-message-feed: #334155;
    --bg-message-bubble: #475569;
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border-color: #475569;
    --hover-bg-secondary: #334155;
    --skill-icon-bg: #1e3a8a;
    --skill-icon-color: #60a5fa;
}

/* === APPLYING VARIABLES === */
body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: "Exo", sans-serif;
    overflow-x: hidden;
    /* Removed fixed box-sizing properties to avoid layout conflicts */
}

body.modal-active {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
}

body:not(.modal-active) {
    position: static;
    overflow-x: hidden;
    width: auto;
    height: auto;
}

.header-bg {
    background-color: var(--bg-header);
}

.section-title {
    position: relative;
    padding-bottom: 1.5rem;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 4px;
    background: linear-gradient(135deg, #3b82f6, #a855f7);
    border-radius: 2px;
    transition: width 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.section-title:hover::after {
    width: 100px;
}

.text-gradient {
    background: linear-gradient(135deg, #3b82f6, #a855f7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Adjusted main tag to better handle section widths */
main {
    width: 100%;
}

section .grid {
    width: 100%;
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
}

img {
    max-width: 100%;
    height: auto;
}

@media (max-width: 768px) {
    .portfolio-card {
        margin-left: auto;
        margin-right: auto;
    }
}

#home img {
    max-width: 100%;
    height: auto;
    object-fit: cover;
}

.mobile-menu-bg {
    background-color: var(--bg-mobile-menu);
    text-align: center;
}

.nav-link,
.mobile-nav-link {
    color: var(--text-primary);
    border-radius: 10px;
}

.nav-link:hover,
.mobile-nav-link:hover {
    color: #a855f7;
}

.mobile-nav-link:hover {
    background-color: var(--hover-bg-secondary);
    border-radius: 10px;
}

.text-secondary {
    color: var(--text-secondary);
}

.text-muted {
    color: var(--text-muted);
}

.portfolio-card {
    background-color: var(--bg-card);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
}

.portfolio-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 25px -5px rgba(168, 85, 247, 0.2), 0 10px 10px -5px rgba(168, 85, 247, 0.1);
}

html.dark .portfolio-card:hover {
    box-shadow: 0 20px 25px -5px rgba(99, 102, 241, 0.25), 0 10px 10px -5px rgba(99, 102, 241, 0.15);
}

.certificate-card {
    background-color: var(--bg-card);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
}

.certificate-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 25px -5px rgba(168, 85, 247, 0.2), 0 10px 10px -5px rgba(168, 85, 247, 0.1);
}

html.dark .certificate-card:hover {
    box-shadow: 0 20px 25px -5px rgba(99, 102, 241, 0.25), 0 10px 10px -5px rgba(99, 102, 241, 0.15);
}

.skill-item {
    background-color: var(--bg-skill-item);
    color: var(--text-primary);
}

.skill-icon-bg {
    background-color: var(--skill-icon-bg);
}

.skill-icon-color {
    color: var(--skill-icon-color);
}

.message-container {
    background-color: var(--bg-card);
}

.message-feed-bg {
    background-color: var(--bg-message-feed);
}

.message-bubble {
    background-color: var(--bg-message-bubble);
    color: var(--text-primary);
}

.form-label,
.form-label-color {
    color: var(--text-secondary);
}

.form-input {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.form-input:focus {
    --tw-ring-color: #a855f7;
    border-color: transparent;
    box-shadow: 0 0 0 2px var(--tw-ring-color);
}

/* Replace existing .portfolio-card rules with this one */
.portfolio-card {
    background-color: var(--bg-card);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.portfolio-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 25px -5px rgba(168, 85, 247, 0.2), 0 10px 10px -5px rgba(168, 85, 247, 0.1);
}

html.dark .portfolio-card:hover {
    box-shadow: 0 20px 25px -5px rgba(99, 102, 241, 0.25), 0 10px 10px -5px rgba(99, 102, 241, 0.15);
}

.portfolio-card-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
    /* Pastikan inner memanjang penuh */
}

.hover-buttons {
    z-index: 10;
    /* Pastikan buttons di atas gambar */
}

.tech-icons {
    align-self: flex-end;
    /* Pastikan tech icons di bottom */
}

.tech-icons iconify-icon {
    cursor: pointer;
}

.certificate-card-inner {
    transition: transform 0.4s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.certificate-card-inner img {
    border-top-left-radius: 0.5rem;
    border-top-right-radius: 0.5rem;
}

.certificate-card-inner .p-6 {
    flex-grow: 1;
}

.footer-icon {
    color: #94a3b8;
    transition: color 0.3s ease, transform 0.3s ease;
}

.footer-icon:hover {
    color: #a855f7;
    transform: scale(1.1);
}

/* === FIX Typing Text === */
#typing-text {
    min-height: 1.5em;
    display: inline-block;
}

/* === Floating Animation Ringan === */
@keyframes floatAnimation {
    0% {
        transform: translateY(0) translateX(0);
    }

    50% {
        transform: translateY(10px) translateX(5px);
    }

    100% {
        transform: translateY(0) translateX(0);
    }
}

/* === Floating Icon Opacity Adjustment === */
.floating-icon {
    position: absolute;
    z-index: 5;
    opacity: 1;
    /* Opasitas dinaikkan agar lebih terlihat di light mode */
    animation: floatAnimation 7s ease-in-out infinite alternate;
}

html.dark .floating-icon {
    opacity: 0.5;
    /* Opasitas juga dinaikkan untuk dark mode */
    mix-blend-mode: screen;
}

/* === Position Icons (Lebih Random) === */
.icon-1 {
    top: 15%;
    left: 20%;
    width: 4.5rem;
    height: 4.5rem;
    animation-duration: 9s;
    animation-delay: -1s;
}

.icon-2 {
    top: 25%;
    right: 15%;
    width: 3.8rem;
    height: 3.8rem;
    animation-duration: 11s;
    animation-delay: -3s;
}

.icon-3 {
    top: 35%;
    left: 30%;
    width: 3.2rem;
    height: 3.2rem;
    animation-duration: 8s;
    animation-delay: -2s;
}

.icon-4 {
    top: 45%;
    right: 25%;
    width: 4rem;
    height: 4rem;
    animation-duration: 10s;
}

.icon-5 {
    top: 55%;
    left: 10%;
    width: 3.5rem;
    height: 3.5rem;
    animation-duration: 12s;
    animation-delay: -4s;
}

.icon-6 {
    top: 65%;
    right: 20%;
    width: 4.2rem;
    height: 4.2rem;
    animation-duration: 9s;
    animation-delay: -2s;
}

.icon-7 {
    top: 75%;
    left: 25%;
    width: 3.7rem;
    height: 3.7rem;
    animation-duration: 11s;
    animation-delay: -1s;
}

.icon-8 {
    top: 80%;
    right: 10%;
    width: 3.3rem;
    height: 3.3rem;
    animation-duration: 8s;
    animation-delay: -3s;
}

.icon-9 {
    top: 85%;
    left: 15%;
    width: 3.6rem;
    height: 3.6rem;
    animation-duration: 10s;
}

/* === Responsive (Ganti blok ini sepenuhnya) === */
@media (max-width: 1024px) {

    /* Aturan untuk tablet tetap sama */
    .icon-1 {
        top: 10%;
        left: 15%;
        width: 4rem;
        height: 4rem;
    }

    .icon-2 {
        top: 20%;
        right: 10%;
        width: 3.5rem;
        height: 3.5rem;
    }

    .icon-3 {
        top: 30%;
        left: 25%;
        width: 3rem;
        height: 3rem;
    }

    .icon-4 {
        top: 40%;
        right: 15%;
        width: 3.5rem;
        height: 3.5rem;
    }

    .icon-5 {
        top: 50%;
        left: 5%;
        width: 3rem;
        height: 3rem;
    }

    .icon-6 {
        top: 60%;
        right: 10%;
        width: 3.8rem;
        height: 3.8rem;
    }

    .icon-7 {
        top: 70%;
        left: 15%;
        width: 3.5rem;
        height: 3.5rem;
    }

    .icon-8 {
        top: 75%;
        right: 5%;
        width: 3rem;
        height: 3rem;
    }

    .icon-9 {
        top: 80%;
        left: 10%;
        width: 3.2rem;
        height: 3.2rem;
    }
}

@media (max-width: 767px) {
    .floating-icon {
        opacity: 0.15;
    }

    /* Menampilkan SEMUA ikon dengan posisi dan ukuran baru untuk mobile */
    .icon-1 {
        top: 15%;
        left: 10%;
        width: 3rem;
        height: 3rem;
    }

    .icon-2 {
        top: 20%;
        right: 8%;
        width: 2.8rem;
        height: 2.8rem;
    }

    .icon-3 {
        top: 35%;
        left: 15%;
        width: 2.5rem;
        height: 2.5rem;
        display: block !important;
    }

    .icon-4 {
        top: 40%;
        right: 12%;
        width: 2.9rem;
        height: 2.9rem;
        display: block !important;
    }

    .icon-5 {
        top: 55%;
        left: 5%;
        width: 2.7rem;
        height: 2.7rem;
        display: block !important;
    }

    .icon-6 {
        top: 60%;
        right: 18%;
        width: 3.1rem;
        height: 3.1rem;
        display: block !important;
    }

    .icon-7 {
        top: 75%;
        left: 20%;
        width: 2.6rem;
        height: 2.6rem;
        display: block !important;
    }

    .icon-8 {
        top: 80%;
        right: 5%;
        width: 2.8rem;
        height: 2.8rem;
    }

    .icon-9 {
        top: 85%;
        left: 10%;
        width: 2.8rem;
        height: 2.8rem;
    }
}

/* === Gradient Outline untuk Foto Profil === */
.profile-image-wrapper::before {
    content: '';
    position: absolute;
    z-index: -1;
    /* Posisikan di belakang gambar */

    /* Atur ukuran outline (misal: 2px di setiap sisi) */
    top: -3px;
    left: -3px;
    right: -3px;
    bottom: -3px;

    border-radius: 9999px;
    /* Opsional: untuk melembutkan sudut */

    /* --- LIGHT MODE: Warna Gradien --- */
    background: linear-gradient(135deg, #3b82f6, #a855f7);

    /* --- Magic: Gunakan gambar sebagai MASK --- */
    -webkit-mask-image: url('/assets/images/home-me.png');
    mask-image: url('/assets/images/home-me.png');
    -webkit-mask-size: contain;
    mask-size: contain;
    -webkit-mask-position: center;
    mask-position: center;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
}

/* === DARK MODE: Atur ulang warna outline === */
html.dark .profile-image-wrapper::before {
    /* Ganti gradien menjadi warna solid yang kontras di dark mode */
    background: var(--text-primary);
}