/**
 * Main Theme Styles
 * Custom variables and overrides for the modern premium feel.
 */

:root {
    --bs-primary: #4F46E5; /* Indigo/blue - enerjetik */
    --bs-primary-rgb: 79, 70, 229;
    --bs-warning: #F59E0B; /* Emas/Prestasi */
    --bs-body-font-family: 'Plus Jakarta Sans', sans-serif;
    --bs-heading-font-family: 'Outfit', sans-serif;
}

body {
    font-family: var(--bs-body-font-family);
    -webkit-font-smoothing: antialiased;
    color: #374151; /* Dark gray */
    line-height: 1.6;
}

.font-outfit {
    font-family: var(--bs-heading-font-family) !important;
}

.ls-1 { letter-spacing: 1px; }
.tracking-wide { letter-spacing: 0.05em; }

/* Utilities */
.transition-all { transition: all 0.3s ease; }
.transition-scale { transition: transform 0.5s ease; }
.max-w-700 { max-width: 700px; }
.letter-spacing-1 { letter-spacing: 1px; }

/* Custom Hover Utilities */
.hover-primary:hover { color: var(--bs-primary) !important; }
.hover-white:hover { color: white !important; }

/* Navbar */
.site-header { transition: background-color 0.3s, box-shadow 0.3s, padding 0.3s; }
.navbar-nav .nav-link { color: #4B5563; padding: 0.5rem 1rem; transition: color 0.3s; }
.navbar-nav .nav-link:hover, .navbar-nav .nav-link.active { color: var(--bs-primary); }

/* =========================================================
   Site Branding & Logo — Flexible, Estetis, Responsive
   ========================================================= */
.site-branding {
    min-width: 0; /* cegah overflow flex di mobile */
}

.site-logo-link {
    flex-shrink: 0;
    line-height: 0;
    border-radius: 50%;
    outline: none;
}

.site-logo-link:focus-visible {
    outline: 2px solid var(--bs-primary);
    outline-offset: 3px;
    border-radius: 8px;
}

/* Satu deklarasi tunggal — hindari duplikat override */
.site-logo {
    width: clamp(38px, 5vw, 55px);
    height: auto;
    max-height: clamp(38px, 5vw, 55px);
    aspect-ratio: 1 / 1;
    object-fit: contain;
    display: block;
    will-change: transform, filter;
    /* transisi untuk hover + shrink saat scroll */
    transition:
        width 0.35s cubic-bezier(0.4, 0, 0.2, 1),
        max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1),
        transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
        filter 0.3s ease;
    /* animasi entrance saat load */
    animation: logoEntrance 0.85s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.site-logo:hover {
    transform: scale(1.12) rotate(4deg);
    filter: drop-shadow(0 4px 10px rgba(79, 70, 229, 0.28));
}

.site-logo:active {
    transform: scale(0.96) rotate(-1deg);
}

.site-branding-text {
    min-width: 0;
    opacity: 0;
    transform: translateX(-14px);
    animation: logoTextSlide 0.6s 0.25s ease-out forwards;
}

.site-branding-text .site-title {
    line-height: 1.1;
}

.site-branding-text .site-title a {
    transition: color 0.25s ease;
}

.site-branding-text .site-title a:hover {
    color: var(--bs-primary) !important;
}

.site-description {
    line-height: 1.35;
    letter-spacing: 0.02em;
    /* Fleksibel: menyesuaikan lebar container, maksimal 2 baris agar header tetap ramping.
       Tidak terpotong di tengah kata seperti text-truncate sebelumnya. */
    max-width: 42ch;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Ikon pada fallback nav menu */
.bapopsi-nav-icon {
    font-size: 0.9em;
    opacity: 0.85;
}

/* Nav link hover/active — pill + underline animation */
.navbar-nav .nav-link {
    position: relative;
    border-radius: 999px;
    transition: color 0.3s, background-color 0.3s;
}
.navbar-nav .nav-link::after {
    content: "";
    position: absolute;
    left: 1rem;
    right: 1rem;
    bottom: 0.1rem;
    height: 2px;
    border-radius: 2px;
    background: var(--bs-primary);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s ease;
}
.navbar-nav .nav-link:hover,
.navbar-nav .nav-link.active {
    color: var(--bs-primary);
    background-color: rgba(79, 70, 229, 0.07);
}
.navbar-nav .nav-link:hover::after,
.navbar-nav .nav-link.active::after {
    transform: scaleX(1);
}

/* Keyframes — Logo */
@keyframes logoEntrance {
    0% {
        opacity: 0;
        transform: scale(0.55) rotate(-12deg);
    }
    60% {
        opacity: 1;
        transform: scale(1.08) rotate(3deg);
    }
    100% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

@keyframes logoTextSlide {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Shrink saat header di-scroll */
.site-header.shrink .site-logo {
    width: clamp(34px, 4.2vw, 42px);
    max-height: clamp(34px, 4.2vw, 42px);
}

.site-header.shrink .site-branding-text .site-title {
    font-size: 1.05rem;
}

/* Responsive — Tablet */
@media (max-width: 991.98px) {
    .site-logo {
        width: 45px;
        max-height: 45px;
    }
    .site-header.shrink .site-logo {
        width: 36px;
        max-height: 36px;
    }
    /* deskripsi tetap tampil di tablet kecil, hanya sembunyi di <576px */
}

/* Responsive — Mobile */
@media (max-width: 575.98px) {
    .site-logo {
        width: 38px;
        max-height: 38px;
    }
    .site-header.shrink .site-logo {
        width: 34px;
        max-height: 34px;
    }
    .site-branding-text .site-title {
        font-size: 1rem !important;
    }
    .site-branding-text .site-description {
        display: none !important;
    }
}

/* Aksesibilitas: hormati preferensi reduced motion */
@media (prefers-reduced-motion: reduce) {
    .site-logo,
    .site-branding-text {
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
        transition: width 0.2s ease, max-height 0.2s ease;
    }
    .site-logo:hover {
        transform: none;
        filter: none;
    }
}

/* Buttons */
.btn { font-weight: 500; transition: all 0.3s ease; }
.btn-primary { background-color: var(--bs-primary); border-color: var(--bs-primary); }
.btn-primary:hover, .btn-primary:focus {
    background-color: #4338CA;
    border-color: #4338CA;
    box-shadow: 0 10px 15px -3px rgba(79, 70, 229, 0.4);
}
.btn-hover-lift:hover { transform: translateY(-3px); }
.btn-bounce { animation: bounce 2s infinite; }

/* Cards & Images */
.custom-card { top: 0; transition: all 0.3s ease; }
.custom-card:hover { top: -10px; box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04) !important; }
.card-img-top-wrap:hover .transition-scale { transform: scale(1.05); }
.custom-hover-card { transition: all 0.3s ease; border: 1px solid transparent; }
.custom-hover-card:hover { background-color: #fff !important; border-color: rgba(79, 70, 229, 0.2); box-shadow: 0 20px 25px -5px rgba(79, 70, 229, 0.1); transform: translateY(-5px); }

/* read more link animation */
.read-more-link i { transition: transform 0.3s ease; }
.read-more-link:hover i { transform: translateX(5px); }

/* Hero Specific */
.bg-light-mesh {
    background-color: #F9FAFB;
    background-image: radial-gradient(#E5E7EB 1px, transparent 1px);
    background-size: 20px 20px;
}
.blur-3xl { filter: blur(64px); }

/* Animations */
@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.9; transform: scale(1.03); }
}
.animate-pulse { animation: pulse 3s cubic-bezier(0.4, 0, 0.6, 1) infinite; }

@keyframes floating {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-20px); }
    100% { transform: translateY(0px); }
}
.floating-anim { animation: floating 6s ease-in-out infinite; }

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-8px); }
    60% { transform: translateY(-4px); }
}

/* Footer Nav */
.footer-nav-list a { color: rgba(255, 255, 255, 0.5); text-decoration: none; transition: color 0.3s, padding-left 0.3s; display: inline-block; }
.footer-nav-list a:hover { color: #fff; padding-left: 5px; }

/* Back to top — sebelumnya ada di footer.php tapi belum ada style */
.back-to-top {
    position: fixed;
    right: 18px;
    bottom: 18px;
    width: 44px;
    height: 44px;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1050;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.25s ease, transform 0.25s ease, background-color 0.2s;
    pointer-events: none;
}
.back-to-top.show {
    display: inline-flex;
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}
.back-to-top:hover {
    transform: translateY(-3px);
}
@media (max-width: 575.98px) {
    .back-to-top { right: 14px; bottom: 14px; width: 40px; height: 40px; }
}

/* Skip link — accessible saat focus keyboard */
.skip-link:focus {
    position: absolute !important;
    top: 8px;
    left: 8px;
    z-index: 9999;
    display: block !important;
    padding: 0.6rem 1rem;
    background: var(--bs-primary);
    color: #fff !important;
    border-radius: 0.5rem;
    text-decoration: none;
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}

/* Print: sembunyikan header sticky & back-to-top */
@media print {
    .site-header, .back-to-top, .topbar-header { display: none !important; }
}
