/* --- Global Styles & Reset --- */
html {
    scroll-behavior: smooth;
}
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: #0f172a;
    color: #e2e8f0;
}

/* ================= PRELOADER ================= */
#preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: #0f172a;
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    transition: opacity 0.8s ease, visibility 0.8s ease;
}
#preloader.preloader-hidden {
    opacity: 0;
    visibility: hidden;
}
.preloader-content h1 {
    color: #fff;
    font-size: 3rem;
    font-weight: 700;
    text-transform: uppercase;
    line-height: 1.2;
    margin-top: 15px;
}
.preloader-content h1 span {
    display: block;
    opacity: 0;
}
.preloader-content .line-1 {
    animation: slideFromRight 1s ease-out 1s forwards;
}
.preloader-content .line-2 {
    animation: slideFromBottom 1s ease-out 1.5s forwards;
}
.preloader-icons {
    display: flex;
    gap: 25px;
    opacity: 0;
    animation: slideDown 1s ease-out 0.5s forwards;
}
.preloader-icons i {
    font-size: 2rem;
    color: #a77dfa;
    background-color: rgba(0, 0, 0, 0.2);
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    animation: glow 2s infinite alternate;
}
.preloader-icons i:nth-child(2) {
    animation-delay: 0.2s;
}
.preloader-icons i:nth-child(3) {
    animation-delay: 0.4s;
}
#typing-text {
    color: #e2e8f0;
    font-family: 'Courier New', Courier, monospace;
    font-size: 1.2rem;
    font-weight: bold;
    margin-top: 25px;
    width: 15ch;
    white-space: nowrap;
    overflow: hidden;
    border-right: 4px solid #e2e8f0;
    animation: typing 2.5s steps(15), blink .5s step-end infinite alternate;
}

/* --- Keyframes Animasi --- */
@keyframes glow {
    from { box-shadow: 0 0 10px #a77dfa, 0 0 20px #a77dfa, 0 0 30px #a77dfa; }
    to { box-shadow: 0 0 20px #bf9dfc, 0 0 30px #bf9dfc, 0 0 40px #bf9dfc; }
}
@keyframes slideDown {
    from { transform: translateY(-80px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
@keyframes slideFromRight {
    from { transform: translateX(100px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}
@keyframes slideFromBottom {
    from { transform: translateY(100px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
@keyframes typing {
    from { width: 0; }
}
@keyframes blink-cursor {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0;
    }
}
@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-20px); }
    100% { transform: translateY(0px); }
}

/* ================= HEADER / NAVIGASI ================= */
header {
    padding: 20px 8%;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 100;
    transition: background-color 0.4s ease;
}
header.header-scrolled {
    background-color: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}
nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
nav .logo {
    font-size: 24px;
    font-weight: 700;
    color: #fff;
    text-decoration: none;
}
nav ul {
    list-style: none;
    display: flex;
    gap: 40px;
}
nav ul li a {
    text-decoration: none;
    color: #e2e8f0;
    font-weight: 600;
    transition: color 0.3s;
}
nav ul li a:hover {
    color: #38bdf8;
}
.menu {
    --s: 40px;
    --c: white;
    display: none;
    height: var(--s);
    aspect-ratio: 1;
    border: none;
    padding: 0;
    border-inline: calc(var(--s)/2) solid #0000;
    box-sizing: content-box;
    --_g1: linear-gradient(var(--c) 20%,#0000 0 80%,var(--c) 0) no-repeat content-box border-box;
    --_g2: radial-gradient(circle closest-side at 50% 12.5%,var(--c) 95%,#0000) repeat-y content-box border-box;
    background: var(--_g2) left var(--_p,0px) top, var(--_g1) left calc(var(--s)/10 + var(--_p,0px)) top, var(--_g2) right var(--_p,0px) top, var(--_g1) right calc(var(--s)/10 + var(--_p,0px)) top;
    background-size: 20% 80%, 40% 100%;
    position: relative;
    clip-path: inset(0 25%);
    -webkit-mask: linear-gradient(90deg,#0000,#000 25% 75%,#0000);
    cursor: pointer;
    transition: background-position .3s var(--_s,.3s), clip-path 0s var(--_s,.6s);
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}
.menu:before, .menu:after {
    content: "";
    position: absolute;
    border-radius: var(--s);
    inset: 40% 0;
    background: var(--c);
    transition: transform .3s calc(.3s - var(--_s,.3s));
}
.menu:checked {
    clip-path: inset(0);
    --_p: calc(-1*var(--s));
    --_s: 0s;
}
.menu:checked:before { transform: rotate(45deg); }
.menu:checked:after { transform: rotate(-45deg); }
.menu:focus-visible {
    clip-path: none;
    -webkit-mask: none;
    border: none;
    outline: 2px solid var(--c);
    outline-offset: 5px;
}

/* ================= SECTION UMUM ================= */
.section-title {
    text-align: center;
    font-size: 36px;
    font-weight: 700;
    margin-bottom: 50px;
    color: #fff;
}
.section-subtitle {
    max-width: 600px;
    margin: 0 auto 40px auto;
    color: #94a3b8;
    line-height: 1.7;
}

/* ================= HERO SECTION ================= */
#hero {
    display: flex;
    align-items: center;
    min-height: 100vh;
    padding: 80px 8% 40px 8%;
}
.hero-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
    width: 100%;
}
/*  GAYA BARU UNTUK FOTO PROFIL */
.hero-profile {
    flex-basis: 30%;
    max-width: 350px;
    border-radius: 50%;
    overflow: hidden;
    box-shadow: 0 0 30px rgba(56, 189, 248, 0.4);
    border: 5px solid #1e293b;
    animation: float 4s ease-in-out infinite;
}
.hero-profile img {
    width: 100%;
    display: block;
}
.hero-text .dynamic-text-container {
    font-size: 1.5rem;
    font-weight: 600;
    color: #94a3b8;
    margin-bottom: 20px;
    height: 1.5rem; /* Beri tinggi tetap agar layout tidak "melompat" */
}
#dynamic-text::after {
    content: '|';
    margin-left: 5px;
    opacity: 1;
    animation: blink-cursor 0.7s infinite;
}
.hero-text h1 {
    font-size: 4rem;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 10px;
    color: #fff;
}
.gradient-text {
    background: linear-gradient(90deg, #38bdf8, #818cf8);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.hero-text h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #94a3b8;
    margin-bottom: 20px;
}
.hero-text p {
    font-size: 1rem;
    color: #94a3b8;
    margin-bottom: 30px;
    max-width: 500px;
}
.hero-buttons {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
}
.cta-button {
    display: inline-block;
    background-color: #38bdf8;
    color: #fff;
    padding: 12px 24px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: background-color 0.3s;
}
.cta-button:hover { background-color: #0ea5e9; }
.cta-button-outline {
    background-color: transparent;
    border: 2px solid #38bdf8;
    color: #38bdf8;
    padding: 10px 22px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: background-color 0.3s, color 0.3s;
}
.cta-button-outline:hover {
    background-color: #38bdf8;
    color: #fff;
}
.hero-socials { display: flex; gap: 20px; }
.hero-socials a {
    color: #94a3b8;
    font-size: 1.5rem;
    transition: color 0.3s, transform 0.3s;
}
.hero-socials a:hover {
    color: #38bdf8;
    transform: translateY(-3px);
}
/* Aturan .hero-image yang lama bisa dihapus */


/* ================= ABOUT ME, PROJECTS, CONTACT, FOOTER ================= */
#about { padding: 80px 8%; }
.about-container { display: flex; justify-content: space-between; align-items: flex-start; gap: 40px; }
.about-text { flex-basis: 50%; line-height: 1.8; color: #94a3b8; }
.about-skills { flex-basis: 45%; }
.about-skills ul { list-style: none; display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; }
.about-skills li { background-color: #1e293b; padding: 20px; border-radius: 8px; text-align: center; font-weight: 600; transition: transform 0.3s; }
.about-skills li:hover { transform: translateY(-5px); }
.about-skills i { font-size: 40px; display: block; margin-bottom: 10px; color: #38bdf8; }

#projects { padding: 80px 8%; }
.projects-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 30px; }
.project-card { background-color: #1e293b; border-radius: 10px; overflow: hidden; box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2); transition: transform 0.3s ease, box-shadow 0.3s ease; }
.project-card:hover { transform: translateY(-10px); box-shadow: 0 8px 25px rgba(56, 189, 248, 0.3); }
.project-image img { width: 100%; height: 200px; object-fit: cover; display: block; }
.project-content { padding: 20px; }
.project-content h3 { font-size: 20px; font-weight: 600; color: #fff; margin-bottom: 10px; }
.project-content p { font-size: 14px; color: #94a3b8; line-height: 1.6; margin-bottom: 15px; }
.project-tags { margin-bottom: 15px; }
.project-tags span { display: inline-block; background-color: #334155; color: #e2e8f0; padding: 4px 10px; border-radius: 5px; font-size: 12px; font-weight: 500; margin-right: 5px; margin-bottom: 5px; }
.project-link { color: #38bdf8; text-decoration: none; font-weight: 600; font-size: 14px; transition: color 0.3s; }
.project-link:hover { color: #7dd3fc; }

#contact { padding: 80px 8%; text-align: center; }
.contact-form { max-width: 600px; margin: 0 auto; text-align: left; }
.form-group { margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 8px; font-weight: 600; color: #cbd5e1; }
.contact-form input, .contact-form textarea { width: 100%; padding: 12px; background-color: #1e293b; border: 1px solid #334155; border-radius: 8px; color: #e2e8f0; font-size: 16px; font-family: 'Poppins', sans-serif; }
.contact-form input:focus, .contact-form textarea:focus { outline: none; border-color: #38bdf8; box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2); }
.contact-form textarea { resize: vertical; }
.submit-button { width: 100%; padding: 15px; background-color: #38bdf8; color: #fff; border: none; border-radius: 8px; font-size: 16px; font-weight: 700; cursor: pointer; transition: background-color 0.3s; }
.submit-button:hover { background-color: #0ea5e9; }

footer { text-align: center; padding: 20px 8%; margin-top: 40px; border-top: 1px solid #1e293b; color: #94a3b8; font-size: 14px; }

/* =================================================== */
/* === BAGIAN BAWAH (GAYA RESPONSIVE/LAYAR KECIL) === */

@media (max-width: 768px) {
    /* --- Preloader Responsif --- */
    .preloader-icons i {
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
    }
    .preloader-icons {
        gap: 20px;
    }
    .preloader-content h1 {
        font-size: 1.8rem;
        margin-top: 25px;
    }
    #typing-text {
        font-size: 1rem;
    }

    /* --- Navigasi Responsif --- */
    .menu {
        display: block;
        z-index: 102;
    }
    nav {
        justify-content: space-between;
    }
    nav ul {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        background: rgba(15, 23, 42, 0.95);
        backdrop-filter: blur(5px);
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 30px;
        opacity: 0;
        transform: scale(1.1);
        transition: opacity 0.3s, transform 0.3s;
        pointer-events: none;
        z-index: 101;
    }
    nav ul li a {
        font-size: 24px;
    }
    .menu:checked ~ ul {
        opacity: 1;
        transform: scale(1);
        pointer-events: auto;
    }

    /* --- Penyesuaian Section Lainnya --- */
    .section-title { font-size: 30px; margin-bottom: 30px; }
    
    /* 👇 GAYA BARU UNTUK HERO RESPONSIVE 👇 */
    #hero {
        padding-top: 120px;
        padding-bottom: 60px;
    }
    .hero-container {
        flex-direction: column; /* Bukan -reverse agar foto tetap di atas */
        gap: 2.5rem;
    }
    .hero-profile {
        width: 200px; /* Ukuran foto di mobile */
        max-width: none;
        animation: none; /* Matikan animasi float di mobile */
    }
    .hero-text {
        flex-basis: 100%;
        align-items: center;
        text-align: center;
    }
    .hero-text h1 { font-size: 2.8rem; }
    .hero-text h2 { font-size: 1.2rem; }

    .about-container { flex-direction: column; align-items: center; text-align: center; }
    .about-text { margin-bottom: 30px; }
    .about-skills ul { grid-template-columns: repeat(2, 1fr); }
    
    .projects-grid { grid-template-columns: repeat(2, 1fr); }

    #contact { padding: 60px 5%; }
}

@media (max-width: 480px) {
    .hero-profile {
        width: 150px; /* Perkecil lagi foto di layar sangat kecil */
    }
    .hero-text h1 { font-size: 2.5rem; }
    .hero-text h2 { font-size: 1.1rem; }

    .projects-grid { grid-template-columns: 1fr; }
}