@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@100;200;300;400;500;600&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    text-decoration: none;
    border: none;
    outline: none;
    font-family: 'Poppins', sans-serif;
}

html {
    /* Base ukuran font 10px untuk memudahkan kalkulasi rem (1rem = 10px) */
    font-size: 62.5%; 
    scroll-behavior: smooth;
}

body {
    width: 100%;
    min-height: 100vh; /* Gunakan min-height agar tidak terpotong jika konten memanjang */
    overflow-x: hidden;
    background-color: black;
    color: white;
}

/* --- HEADER & NAVIGASI --- */
header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    padding: 2rem 9%; /* Padding sedikit disesuaikan agar lebih proporsional */
    background-color: rgba(0, 0, 0, 0.8); /* Tambahkan sedikit background agar teks menu tetap terbaca saat di-scroll */
    backdrop-filter: blur(10px); /* Efek blur modern */
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 100;
    transition: 0.3s ease;
}

.logo {
    font-size: clamp(2rem, 3vw, 3rem); /* Ukuran teks logo fleksibel mengikuti lebar layar */
    color: #b74b4b;
    font-weight: 800;
    cursor: pointer;
    transition: 0.5s ease;
}

.logo:hover {
    transform: scale(1.05);
}

nav a {
    font-size: 1.8rem;
    color: white;
    margin-left: 3rem; /* Sedikit dirapatkan */
    font-weight: 500;
    transition: 0.3s ease;
    border-bottom: 3px solid transparent;
}

nav a:hover,
nav a.active {
    color: #b74b4b;
    border-bottom: 3px solid #b74b4b;
}

/* --- BAGIAN HOME --- */
section {
    min-height: 100vh;
    padding: 10rem 9% 5rem; /* Top padding diperbesar agar tidak tertutup fixed header */
    display: flex;
    justify-content: center;
    align-items: center;
}

.home {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: clamp(3rem, 5vw, 8rem); /* Jarak antar elemen fleksibel */
    flex-wrap: wrap; /* Mengizinkan elemen turun ke bawah jika layar sempit */
    width: 100%;
}

.home-content {
    flex: 1 1 500px; /* Fleksibel membesar/mengecil, minimum 500px sebelum wrap */
}

.home-content h1 {
    font-size: clamp(4rem, 6vw, 6rem); /* Ukuran mengecil otomatis di HP, membesar di Desktop */
    font-weight: 700;
    line-height: 1.2;
}

span {
    color: #b74b4b;
}

.home-content h3 {
    font-size: clamp(2.5rem, 4vw, 4rem);
    margin-bottom: 1rem;
    font-weight: 700;
}

.home-content p {
    font-size: clamp(1.4rem, 2vw, 1.6rem);
    line-height: 1.6;
    margin-bottom: 2rem; /* Tambah jarak dengan ikon */
    text-align: justify; /* Opsional: Agar teks deskripsi lebih rapi */
}

/* --- GAMBAR PROFIL --- */
.home-img {
    /* Menggunakan clamp untuk batas ukuran terkecil dan terbesar */
    width: clamp(250px, 32vw, 400px); 
    aspect-ratio: 1 / 1; /* Memastikan rasio selalu kotak (sebelum dibulatkan) */
    border-radius: 50%;
    overflow: hidden;
    box-shadow: 0 0 25px #b74b4b;
    flex-shrink: 0; 
}

.home-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: pointer;
    transition: 0.3s ease;
}

.home-img img:hover {
    transform: scale(1.05); /* Efek zoom tipis saat digeser */
}

/* --- SOSIAL MEDIA & TOMBOL --- */
.social-icons a {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 4rem;
    height: 4rem;
    background-color: transparent;
    border: 0.2rem solid #b74b4b;
    font-size: 2rem;
    border-radius: 50%;
    margin: 0 1.5rem 3rem 0;
    transition: 0.3s ease;
    color: #b74b4b;
}

.social-icons a:hover {
    color: black;
    transform: scale(1.1) translateY(-5px);
    background-color: #b74b4b;
    box-shadow: 0 0 25px #b74b4b;
}

.btn {
    display: inline-block;
    padding: 1rem 2.8rem;
    background-color: black;
    border-radius: 4rem;
    font-size: 1.6rem;
    color: #b74b4b;
    letter-spacing: 0.1rem;
    font-weight: 600;
    border: 2px solid #b74b4b;
    transition: 0.3s ease;
    cursor: pointer;
}

.btn:hover {
    transform: scale(1.03);
    background-color: #b74b4b;
    color: black;
    box-shadow: 0 0 25px #b74b4b;
}

/* --- EFEK MENGETIK (DIPERBAIKI) --- */
.typing-text {
    font-size: clamp(1.8rem, 4vw, 3.4rem); /* Sedikit diperkecil untuk mobile */
    font-weight: 600;
    min-width: 200px; /* Diperkecil agar tidak mendorong layout di HP */
}

.typing-text span {
    position: relative;
    white-space: nowrap; /* KUNCI: Mencegah teks turun ke baris baru */
}

.typing-text span::before {
    content: "Software Developer";
    color: #b74b4b;
    animation: words 20s infinite;
}

.typing-text span::after {
    content: "";
    background-color: black;
    position: absolute;
    width: calc(100% + 8px);
    height: 110%; /* Sedikit lebih tinggi agar menutup sempurna */
    border-left: 3px solid black;
    right: -8px;
    top: 0;
    animation: cursor 0.6s infinite, typing 20s steps(14) infinite;
}
/* Animasi kursor berkedip */
@keyframes cursor {
    to { 
        border-left: 3px solid #b74b4b; 
    }
}

/* Animasi pergerakan kotak hitam untuk membuat efek mengetik & menghapus */
@keyframes typing {
    0%, 20%, 40%, 60%, 80%, 100% {
        width: calc(100% + 8px); /* Teks tertutup rapat */
    }
    10%, 15%, 30%, 35%, 50%, 55%, 70%, 75%, 90%, 95% {
        width: 0; /* Teks terbuka / selesai diketik */
    }
}

/* Teks yang berubah-ubah sesuai dengan waktu animasi mengetik */
@keyframes words {
    0%, 20% { content: "Web Developer"; }
    21%, 40% { content: "Backend Developer"; }
    41%, 60% { content: "Game Developer"; }
    61%, 80% { content: "Gamer"; }
    81%, 100% { content: "Tech Enthusiast"; }
}

/* --- MEDIA QUERIES (RESPONSIVE) --- */
@media (max-width: 995px) {
    /* Ubah arah flex menjadi kolom untuk layar HP/Tablet */
    .home {
        flex-direction: column-reverse; /* Gambar di atas, teks di bawah */
        text-align: center;
        margin-top: 2rem;
    }

    .home-content {
        flex: 1 1 auto;
    }

    .social-icons {
        display: flex;
        justify-content: center; /* Posisikan ikon sosial media ke tengah di mode mobile */
    }

    .home-img {
        width: clamp(200px, 60vw, 350px); /* Gambar sedikit diperbesar persentasenya untuk mobile */
        margin-bottom: 3rem;
    }

    /* Navigasi Mobile */
    nav {
        position: absolute;
        display: none;
        top: 100%; /* Turun ke bawah header secara tepat */
        right: 0;
        width: 100%; /* Penuhi layar secara horizontal agar lebih mudah diklik */
        border-bottom: 3px solid #b74b4b;
        background-color: #161616;
        padding: 2rem;
        text-align: center;
    }

    nav.active {
        display: block;
    }

    nav a {
        display: block;
        font-size: 2rem;
        margin: 2rem 0;
    }

    nav a:hover,
    nav a.active {
        padding: 1rem;
        border-radius: 0.5rem;
        border-bottom: none;
        background-color: #b74b4b;
        color: black;
    }
}