/* ==============================================
   1. Universal Styles & Design Tokens
   ============================================== */
:root {
    /* Color Palette */
    --prussian-blue: #0B3954; /* Deep, rich blue for dark backgrounds and text */
    --celeste-blue: #F7F9FB; /* Light, airy background */
    --saffron-gold: #FFC43D; /* Vibrant accent for CTAs */
    --gunmetal-gray: #333745; /* Primary text color */
    --slate-gray: #5A6A7D;   /* Secondary text, subtitles */
    --white: #FFFFFF;
    
    /* Typography */
    --font-primary: 'Poppins', sans-serif;

    /* Spacing & Layout */
    --section-padding: 80px 0;
    --container-width: 1200px;

    /* Effects */
    --border-radius-sm: 8px;
    --border-radius-md: 12px;
    --box-shadow-light: 0 4px 15px rgba(0, 0, 0, 0.06);
    --box-shadow-strong: 0 8px 25px rgba(0, 0, 0, 0.12);
    --transition-speed: 0.3s ease;
}

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

html { scroll-behavior: smooth; }

body {
    font-family: var(--font-primary);
    line-height: 1.7;
    color: var(--gunmetal-gray);
    background-color: var(--celeste-blue);
    overflow-x: hidden;
}

/* ==============================================
   2. Typography
   ============================================== */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: -0.02em;
    color: var(--prussian-blue);
}

h1 { font-size: 3.8rem; margin-bottom: 0.5em; }
h2.section-title { font-size: 2.5rem; text-align: center; margin-bottom: 0.3em; }
h3 { font-size: 1.6rem; }
p { font-size: 1.05rem; margin-bottom: 1em; }
p.section-subtitle {
    font-size: 1.15rem;
    color: var(--slate-gray);
    max-width: 750px;
    margin: 0 auto 50px;
    text-align: center;
}
/* Style for the Hero subtitle text when not typing (so it's visible initially if JS fails or for SEO) */
#hero-subtitle-text {
    color: rgba(255, 255, 255, 0.9); /* Original color for hero paragraph */
    font-size: 1.3rem; 
    max-width: 600px; 
    margin: 0 auto 40px;
    /* REMOVED: opacity: 0; - Now handled by JS on typeEffect start */
}
/* Ensure about subtitle is hidden by default before typing starts */
#about-subtitle-text {
    /* REMOVED: opacity: 0; - Now handled by JS on typeEffect start */
}
.light-text { color: var(--white); }

/* ==============================================
   3. Reusable Components (Buttons, etc.)
   ============================================== */
.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 1.5rem;
}
.text-center { text-align: center; }
.dark-bg { background-color: var(--prussian-blue); }
.section-spacing { padding: var(--section-padding); }

.btn {
    display: inline-block;
    padding: 14px 32px;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
    border: none;
    cursor: pointer;
    transition: all var(--transition-speed);
}
.btn-primary {
    background-color: var(--saffron-gold);
    color: var(--prussian-blue);
    box-shadow: 0 4px 10px rgba(255, 196, 61, 0.4);
}
.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(255, 196, 61, 0.6);
}
.btn-secondary {
    background-color: transparent;
    color: var(--prussian-blue);
    border: 2px solid #E0E4E8;
}
.btn-secondary:hover {
    background-color: var(--prussian-blue);
    color: var(--white);
    border-color: var(--prussian-blue);
}

/* ==============================================
   4. Header & Navigation
   ============================================== */
#header {
    padding: 15px 0;
    position: fixed;
    width: 100%;
    top: 0;
    left: 0;
    z-index: 1000;
    transition: all var(--transition-speed);
}
#header.sticky {
    padding: 10px 0;
    background-color: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.logo-img { height: 45px; transition: height var(--transition-speed); }
#header.sticky .logo-img { height: 38px; }

.nav-links { list-style: none; display: flex; }
.nav-links li { margin-left: 35px; }
.nav-links a {
    color: var(--prussian-blue); /* Default for nav links */
    text-decoration: none;
    font-weight: 500;
    padding-bottom: 5px;
    position: relative;
    transition: color var(--transition-speed);
}
/* Warna teks navigasi saat header TIDAK sticky (di hero section) */
#header:not(.sticky) .nav-links a { color: var(--white); } 
.nav-links a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    background-color: var(--saffron-gold);
    left: 50%;
    transform: translateX(-50%);
    bottom: 0;
    transition: width var(--transition-speed);
}
.nav-links a:hover::after, .nav-links a.active::after { width: 100%; }
.nav-links a:hover, .nav-links a.active { color: var(--saffron-gold); }
#header.sticky .nav-links a:hover, #header.sticky .nav-links a.active { color: var(--prussian-blue); }

.hamburger { display: none; cursor: pointer; }
.hamburger .bar {
    display: block; width: 25px; height: 3px; margin: 5px auto;
    background-color: var(--prussian-blue); /* Default bar color */
    transition: all 0.3s ease-in-out;
}
/* Warna bar hamburger saat header TIDAK sticky (di hero section) */
#header:not(.sticky) .hamburger .bar { background-color: var(--white); } 

/* ==============================================
   5. Sections
   ============================================== */

/* --- Hero --- */
#hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: url('../img/landing.webp') no-repeat center center/cover; /* Ganti dengan gambar hero yang paling menarik */
    position: relative;
    color: var(--white);
}
.hero-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(180deg, rgba(11, 57, 84, 0.8) 0%, rgba(11, 57, 84, 0.6) 100%);
}
#hero .container { position: relative; z-index: 2; }
#hero h1 { color: var(--white); text-shadow: 0 2px 10px rgba(0,0,0,0.3); }
/* The hero subtitle paragraph color and size is now handled by #hero-subtitle-text, no change here */


/* --- Portfolio --- */
.filter-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 40px;
}
.filter-btn {
    padding: 8px 20px;
    font-size: 0.95rem;
    font-weight: 500;
    border: 1px solid #ddd;
    background-color: var(--white);
    color: var(--slate-gray);
    border-radius: 50px;
    cursor: pointer;
    transition: all var(--transition-speed);
}
.filter-btn:hover {
    background-color: #f0f0f0;
    border-color: #ccc;
}
.filter-btn.active {
    background-color: var(--prussian-blue);
    color: var(--white);
    border-color: var(--prussian-blue);
}

.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}
.portfolio-item {
    background-color: var(--white);
    border-radius: var(--border-radius-md);
    box-shadow: var(--box-shadow-light);
    overflow: hidden;
    position: relative;
    transition: transform var(--transition-speed), box-shadow var(--transition-speed);
}
.portfolio-item:hover {
    transform: translateY(-8px);
    box-shadow: var(--box-shadow-strong);
}
.portfolio-item img {
    width: 100%; height: 300px;
    object-fit: cover; display: block;
    transition: transform 0.4s ease;
}
.portfolio-item:hover img { transform: scale(1.05); }

.portfolio-info {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 20px;
    background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
    color: var(--white);
    transform: translateY(30%);
    opacity: 0;
    transition: all 0.4s ease;
}
.portfolio-item:hover .portfolio-info {
    transform: translateY(0);
    opacity: 1;
}
.portfolio-info h3 { color: var(--white); font-size: 1.3rem; margin-bottom: 5px; }
.portfolio-info p { color: rgba(255,255,255,0.85); font-size: 0.9rem; margin: 0; }

/* --- Products --- */
.products-section .section-title { margin-bottom: 60px; }
.product-item {
    display: flex; align-items: center; gap: 50px;
    margin-bottom: 80px;
}
.product-item:last-child { margin-bottom: 0; }
.product-item-reverse { flex-direction: row-reverse; }
.product-img-container {
    flex: 1;
    max-width: 500px;
    border-radius: var(--border-radius-md);
    overflow: hidden;
    box-shadow: var(--box-shadow-strong);
}
.product-img { width: 100%; display: block; }
.product-info { flex: 1.2; }
.product-info h3 { font-size: 2rem; color: var(--white); }
.product-info p { color: rgba(255,255,255,0.8); }

/* --- Partners --- */
.partner-grid {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 40px; margin-top: 30px;
}
.partner-item {
    background-color: var(--white);
    border-radius: var(--border-radius-md);
    box-shadow: var(--box-shadow-light);
    padding: 40px; text-align: center;
    transition: all var(--transition-speed);
}
.partner-item:hover { transform: translateY(-5px); box-shadow: var(--box-shadow-strong); }
.partner-logo { max-height: 40px; margin-bottom: 25px; object-fit: contain; }
.partner-item h3 { margin-bottom: 10px; }
.partner-item p { color: var(--slate-gray); margin-bottom: 25px; }

/* --- CTA Section --- */
.cta-section { background: linear-gradient(45deg, var(--prussian-blue), #165373); }
.cta-section h2 { color: var(--white); }
.cta-section p { color: rgba(255,255,255,0.85); max-width: 600px; margin: 0 auto 30px; }

/* --- Contact --- */
.contact-wrapper {
    display: grid; grid-template-columns: 1fr 1.5fr; gap: 60px;
    background-color: var(--white);
    padding: 50px; border-radius: var(--border-radius-md);
    box-shadow: var(--box-shadow-light);
}
.contact-info h3 { margin-bottom: 25px; }
.contact-info p { margin-bottom: 15px; }
.contact-info a { color: var(--prussian-blue); text-decoration: none; font-weight: 500; }
.contact-info a:hover { color: var(--saffron-gold); }
.social-links { display: flex; gap: 20px; margin-top: 30px; }
.social-links svg { color: var(--slate-gray); transition: all var(--transition-speed); }
.social-links a:hover svg { color: var(--prussian-blue); transform: translateY(-2px); }

.form-group { margin-bottom: 20px; }
.form-group label {
    display: block; margin-bottom: 8px; font-weight: 600; font-size: 0.9rem;
}
.form-group input, .form-group textarea {
    width: 100%; padding: 14px;
    border: 1px solid #E0E4E8;
    border-radius: var(--border-radius-sm);
    font-size: 1rem; font-family: var(--font-primary);
    transition: all var(--transition-speed);
}
.form-group input::placeholder, .form-group textarea::placeholder { color: #aaa; }
.form-group input:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--saffron-gold);
    box-shadow: 0 0 0 3px rgba(255, 196, 61, 0.3);
}

/* ==============================================
   6. Footer & Back to Top Button
   ============================================== */
#footer { padding: 50px 0; }
.footer-logo .logo-img { height: 45px; margin-bottom: 20px; filter: brightness(0) invert(1); }
#footer p { font-size: 0.9rem; opacity: 0.7; margin-bottom: 15px; color: var(--white); }
.footer-links { margin-bottom: 20px; }
.footer-links a {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none; margin: 0 10px;
    transition: color var(--transition-speed);
}
.footer-links a:hover { color: var(--white); }

.back-to-top {
    position: fixed; bottom: 30px; right: 30px;
    width: 50px; height: 50px;
    background-color: var(--saffron-gold);
    color: var(--prussian-blue);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all var(--transition-speed);
}
.back-to-top.visible {
    opacity: 1; visibility: visible; transform: translateY(0);
}

/* ==============================================
   7. Animations & Responsive Design
   ============================================== */

/* === NEW: Typing Animation Specific Styles === */
@keyframes blinkCaret {
    from, to { border-color: transparent }
    50% { border-color: var(--slate-gray); } /* Default caret color for light background */
}

@keyframes blinkCaretHero {
    from, to { border-color: transparent }
    50% { border-color: var(--white); } /* White caret for dark background */
}

.typing-text {
    white-space: pre-wrap; /* Keeps line breaks and spaces */
    overflow: hidden; /* Hides text not yet typed */
    border-right: 2px solid; /* Initial caret. Color will be inherited or specified by ID. */
    animation: blinkCaret 0.75s step-end infinite;
    /* REMOVED: opacity: 1 !important; transform: none !important;
       This is now handled by element.style.opacity in JS for persistence. */
}

/* For hero section's paragraph, make the caret white and use its own blink animation */
#hero-subtitle-text.typing-text {
    border-color: var(--white); /* White caret */
    animation: blinkCaretHero 0.75s step-end infinite;
}

/* For about section's paragraph, use default caret color (slate-gray) */
#about-subtitle-text.typing-text {
    border-color: var(--slate-gray); /* Gray caret */
    /* animation: blinkCaret 0.75s step-end infinite; (already default, can be omitted) */
}

/* Make sure elements that will be typed don't have conflicting initial opacity from general animations */
/* This is mostly for elements wrapped by .anim- classes, ensures JS has control */
#hero-subtitle-text,
#about-subtitle-text {
    /* Set an initial transition property to ensure smooth transition from initial render if any */
    transition: opacity 0.3s ease-out; /* Add transition for opacity when JS sets it to 1 */
}

/* The general anim- classes should still work for containers/other elements */
.anim-slide-up, .anim-fade-in, .anim-scale-up, .anim-slide-left, .anim-slide-right, .anim-fade-in-up {
    opacity: 0;
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}
/* No need to specify anything for hero subtitle's opacity here, JS will override it */

.animate {
    opacity: 1;
    transform: none;
}
.anim-delay-sm { transition-delay: 0.2s; }
.anim-delay-md { transition-delay: 0.4s; }


@media (max-width: 992px) {
    h1 { font-size: 3rem; }
    h2.section-title { font-size: 2rem; }
    .product-item, .product-item-reverse { flex-direction: column; text-align: center; }
    .product-img-container { max-width: 100%; margin-bottom: 30px; }
    .contact-wrapper { grid-template-columns: 1fr; }
    .partner-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .section-spacing { padding: 60px 0; }
    .nav-links {
        display: none; 
        flex-direction: column; 
        width: 100%;
        position: absolute; 
        top: 75px; /* Sesuaikan dengan tinggi header Anda */
        left: 0;
        background-color: var(--white); /* Latar belakang putih untuk menu terbuka */
        padding: 20px 0; 
        box-shadow: var(--box-shadow-strong);
        z-index: 990; /* Pastikan menu di atas konten lain */
    }
    .nav-links.active { 
        display: flex; 
        min-height: calc(100vh - 75px); 
        overflow-y: auto; 
    }
    .nav-links li { margin: 15px 0; text-align: center; }
    
    /* Pastikan warna teks navigasi selalu gelap saat menu mobile aktif,
       dengan !important untuk menimpa aturan warna putih dari hero section */
    .nav-links.active a { 
        color: var(--prussian-blue) !important; 
    }
    /* Pastikan hover/active state juga konsisten saat menu aktif */
    .nav-links.active a:hover, 
    .nav-links.active a.active {
        color: var(--saffron-gold) !important; /* Gunakan warna aksen saat hover/active */
    }


    .hamburger { display: block; }
    .hamburger.active .bar:nth-child(2) { opacity: 0; }
    .hamburger.active .bar:nth-child(1) { transform: translateY(8px) rotate(45deg); }
    .hamburger.active .bar:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

    /* Pastikan bar hamburger berwarna gelap saat aktif (menjadi 'X'),
       agar terlihat di latar belakang menu mobile yang putih */
    .hamburger.active .bar {
        background-color: var(--prussian-blue) !important; 
    }
}

@media (max-width: 576px) {
    h1 { font-size: 2.5rem; }
    .filter-buttons { flex-wrap: wrap; gap: 10px; }
    .contact-wrapper { padding: 30px; }
}
